-
Notifications
You must be signed in to change notification settings - Fork 537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert @fluid-example/table-document tests to use esnext modules #15939
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,16 @@ module.exports = { | |
rules: { | ||
"@typescript-eslint/strict-boolean-expressions": "off", | ||
}, | ||
overrides: [ | ||
{ | ||
// Rules only for test files | ||
files: ["*.spec.ts", "src/test/**"], | ||
rules: { | ||
// ESLint's resolver doesn't resolve relative imports of ESNext modules correctly, since | ||
// it resolves the path relative to the .ts file (and assumes a file with a .js extension | ||
// should exist there) | ||
"import/no-unresolved": ["error", { ignore: ["^\\.(.*)\\.js$"] }], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i'd love to make eslint's module resolver understand these imports, but I'm not sure it's possible out of the box (we'd have to maintain our own resolver, and I'm not sure if it would be a trivial wrapper over the base node resolver or not). I don't think this rule provides particularly high value for relative imports though, so IMO it's not the worst. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Someone must have written a solution for this already, right? Typescript transpiled to a different folder + ESM should be a common scenario by now...? Can be addressed separately. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for prodding me to look into this again. I think we can actually make this work nicely by removing eslint-plugin-unused-imports, transitioning to eslint-plugin-import, and updating our import resolve to be eslint-import-resolver-typescript (where the default There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
}, | ||
}, | ||
], | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit. There should be no
*.spec.ts
files outsidesrc/test/
anyway, right? Not 100% sure about the glob syntax, if it's incorrect then just keepsrc/test/**
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like we use this glob in basically all our other packages with "test-only overrides". i'd prefer to keep that consistent over some simplification. We do want non-.spec files inside the test-folder to be exempted as well though, so if we were to change it, it should be
src/test/**