-
Notifications
You must be signed in to change notification settings - Fork 17
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
BREAKING: Bump ESLint to ^9.11.1
, bump related ESLint dependencies, and rewrite configs to use flat configs
#370
Merged
Merged
Changes from 23 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
1d20817
Update main ESLint config to flat config format
Mrtenz bccb33c
Bump all related ESLint dependencies
Mrtenz 0503af4
Convert base config to flat config format
Mrtenz 83155c1
Convert browser config to flat config format
Mrtenz 462fd6b
Convert CommonJS config to flat config format
Mrtenz c329998
Convert Jest config to flat config format
Mrtenz 84cdc64
Convert Mocha config to flat config format
Mrtenz 815177e
Convert Node.js config to flat config format
Mrtenz 935cd51
Convert TypeScript config to flat config format
Mrtenz 7d80761
Replace `jest/no-if` with `jest/no-conditional-in-test`
Mrtenz ec9cbd4
Add dependency on @metamask/eslint-config-jest to root package
Mrtenz 6860331
Add name and files to all configs
Mrtenz 58c2d1e
Update validate-config script
Mrtenz 6753879
Update snapshots
Mrtenz c46cfd8
Normalize snapshots
Mrtenz 69c38f9
Fix lint errors
Mrtenz 5b8f52e
Update formatting of package.jsons
Mrtenz d7a0b66
Update configs to use helper
Mrtenz a66e4d7
Fix config validation script when using Node.js 18
Mrtenz dcb7bdd
Update all READMEs
Mrtenz fb2ad66
Set type to module for all packages
Mrtenz c2f759e
Use jsdoc error config for TypeScript
Mrtenz 071cdd0
Set module and moduleResolution to Node16
Mrtenz 34f7c67
Remove Jest types
Mrtenz d448f10
Remove import attributes in favour of `require`
Mrtenz 4b8e926
Disable `@typescript-eslint/no-duplicate-type-constituents`
Mrtenz 25045b4
Fix tests
Mrtenz 80e8dfd
Disable `no-implicit-globals`
Mrtenz 00ebecd
Disable `@typescript-eslint/no-redundant-type-constituents`
Mrtenz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
// All of these are defaults except singleQuote and endOfLine, but we specify them | ||
// for explicitness | ||
module.exports = { | ||
// All of these are defaults except singleQuote and endOfLine, but we specify | ||
// them for explicitness | ||
const config = { | ||
endOfLine: 'auto', | ||
quoteProps: 'as-needed', | ||
singleQuote: true, | ||
tabWidth: 2, | ||
trailingComma: 'all', | ||
plugins: ['prettier-plugin-packagejson'], | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// @ts-check | ||
|
||
// @ts-expect-error - `@babel/eslint-parser` doesn't have TypeScript types. | ||
import babel from '@babel/eslint-parser'; | ||
import base from '@metamask/eslint-config'; | ||
import jest from '@metamask/eslint-config-jest'; | ||
import nodejs from '@metamask/eslint-config-nodejs'; | ||
import typescript from '@metamask/eslint-config-typescript'; | ||
// eslint-disable-next-line import-x/no-unresolved | ||
import tseslint from 'typescript-eslint'; | ||
|
||
const config = tseslint.config( | ||
{ | ||
ignores: ['.yarn/'], | ||
}, | ||
|
||
...base, | ||
...nodejs, | ||
|
||
{ | ||
files: [ | ||
'**/*.ts', | ||
'**/*.tsx', | ||
'**/*.mts', | ||
'**/*.cts', | ||
'**/*.mtsx', | ||
'**/*.ctsx', | ||
], | ||
extends: typescript, | ||
}, | ||
|
||
{ | ||
files: ['**/*.test.mjs'], | ||
extends: jest, | ||
rules: { | ||
'no-shadow': [ | ||
'error', | ||
{ | ||
allow: ['describe', 'it', 'expect'], | ||
}, | ||
], | ||
}, | ||
}, | ||
|
||
{ | ||
name: 'main', | ||
files: ['**/*.js', '**/*.mjs'], | ||
|
||
languageOptions: { | ||
ecmaVersion: 2022, | ||
|
||
sourceType: 'module', | ||
|
||
parser: babel, | ||
parserOptions: { | ||
requireConfigFile: false, | ||
babelOptions: { | ||
plugins: ['@babel/plugin-syntax-import-attributes'], | ||
}, | ||
}, | ||
}, | ||
|
||
rules: { | ||
'import-x/no-dynamic-require': 'off', | ||
'import-x/no-nodejs-modules': 'off', | ||
'jsdoc/check-tag-names': 'off', | ||
'jsdoc/no-types': 'off', | ||
'n/global-require': 'off', | ||
'n/no-process-exit': 'off', | ||
'n/no-sync': 'off', | ||
'n/no-unpublished-require': 'off', | ||
}, | ||
}, | ||
); | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is this safe because consumers always use this package as a devDep? Are we sure this doesn't affect downstream CJS packages?
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.
Looking at the eslint v9 migrate guide, looks like we only need to worry about CJS configurations importing from our repo, and that shouldn't be a problem for long since eslint is now set up to use ESM by default?
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.
Consumers can add it and use it even if they use
type: commonjs
, as long as the config is a.mjs
file. I figured we might as well update all places where we consume the libraries since we have to rewrite the majority of the configs anyway.