-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update for ESLint v9 compatibility (#52)
### Changelog Updates the package for ESLint v9 compatibility. Most of the peerDeps are now actual deps. ### Docs None ### Description Downstream: - foxglove/crc#212
- Loading branch information
Showing
26 changed files
with
1,634 additions
and
1,314 deletions.
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
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 |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
*.log | ||
*.tsbuildinfo | ||
node_modules/ | ||
dist |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,122 @@ | ||
module.exports = { | ||
extends: ["eslint:recommended", "plugin:prettier/recommended"], | ||
plugins: ["@foxglove", "import", "filenames", "es"], | ||
parserOptions: { | ||
ecmaVersion: 2020, | ||
sourceType: "module", | ||
}, | ||
rules: { | ||
// even new Safari versions do not support regexp lookbehinds | ||
"es/no-regexp-lookbehind-assertions": "error", | ||
const { fixupPluginRules } = require("@eslint/compat"); | ||
const js = require("@eslint/js"); | ||
// @ts-expect-error Missing type definitions | ||
const es = require("eslint-plugin-es"); | ||
// @ts-expect-error Missing type definitions | ||
const filenames = require("eslint-plugin-filenames"); | ||
// @ts-expect-error Missing type definitions | ||
const importPlugin = require("eslint-plugin-import"); | ||
const eslintPluginPrettierRecommended = require("eslint-plugin-prettier/recommended"); | ||
|
||
// import plugin is slow, only enable the critical stuff | ||
"import/export": "error", | ||
"import/first": "error", | ||
"import/named": "error", | ||
"import/newline-after-import": "error", | ||
"import/no-duplicates": "error", | ||
"import/no-mutable-exports": "error", | ||
"import/no-useless-path-segments": "error", | ||
"import/order": [ | ||
"error", | ||
{ | ||
alphabetize: { | ||
order: "asc", | ||
}, | ||
"newlines-between": "always", | ||
groups: [ | ||
["builtin", "external"], | ||
["internal"], | ||
["parent", "sibling", "index"], | ||
], | ||
const foxglove = require("../plugin"); | ||
|
||
const fixedFilenames = fixupPluginRules(filenames); | ||
|
||
/** @type {import("eslint").Linter.Config[]} */ | ||
module.exports = [ | ||
js.configs.recommended, | ||
eslintPluginPrettierRecommended, | ||
{ | ||
linterOptions: { | ||
reportUnusedDisableDirectives: "error", | ||
}, | ||
plugins: { | ||
"@foxglove": foxglove, | ||
import: importPlugin, | ||
es: fixupPluginRules(es), | ||
|
||
// eslint-plugin-filenames allows rules to have options, but fixupPluginRules defaults to a | ||
// schema that does not allow passing any options. We replace this with `false` to disable | ||
// validation so that options can be passed in. | ||
filenames: { | ||
...fixedFilenames, | ||
rules: Object.fromEntries( | ||
Object.entries(fixedFilenames.rules ?? {}).map(([ruleId, rule]) => [ | ||
ruleId, | ||
{ | ||
...rule, | ||
meta: { | ||
...rule.meta, | ||
schema: rule.meta?.schema ?? false, | ||
}, | ||
}, | ||
]) | ||
), | ||
}, | ||
], | ||
}, | ||
rules: { | ||
// even new Safari versions do not support regexp lookbehinds | ||
"es/no-regexp-lookbehind-assertions": "error", | ||
|
||
"filenames/match-exported": "error", | ||
// import plugin is slow, only enable the critical stuff | ||
"import/export": "error", | ||
"import/first": "error", | ||
"import/named": "error", | ||
"import/newline-after-import": "error", | ||
"import/no-duplicates": "error", | ||
"import/no-mutable-exports": "error", | ||
"import/no-useless-path-segments": "error", | ||
"import/order": [ | ||
"error", | ||
{ | ||
alphabetize: { | ||
order: "asc", | ||
}, | ||
"newlines-between": "always", | ||
groups: [ | ||
["builtin", "external"], | ||
["internal"], | ||
["parent", "sibling", "index"], | ||
], | ||
}, | ||
], | ||
|
||
// require double equal for null and undefined, triple equal everywhere else | ||
"@foxglove/strict-equality": "error", | ||
"@foxglove/no-return-promise-resolve": "error", | ||
"@foxglove/prefer-hash-private": "error", | ||
"filenames/match-exported": "error", | ||
|
||
// require curly braces everywhere | ||
curly: "error", | ||
// require double equal for null and undefined, triple equal everywhere else | ||
"@foxglove/strict-equality": "error", | ||
"@foxglove/no-return-promise-resolve": "error", | ||
"@foxglove/prefer-hash-private": "error", | ||
|
||
// avoid eval | ||
"no-eval": "error", | ||
"no-implied-eval": "error", | ||
"no-new-func": "error", | ||
// require curly braces everywhere | ||
curly: "error", | ||
|
||
// unused vars must have `_` prefix | ||
"no-unused-vars": [ | ||
"error", | ||
{ | ||
vars: "all", | ||
args: "after-used", | ||
varsIgnorePattern: "^_", | ||
argsIgnorePattern: "^_", | ||
}, | ||
], | ||
// avoid eval | ||
"no-eval": "error", | ||
"no-implied-eval": "error", | ||
"no-new-func": "error", | ||
|
||
"no-underscore-dangle": [ | ||
"error", | ||
{ | ||
allowAfterThis: true, | ||
}, | ||
], | ||
// unused vars must have `_` prefix | ||
"no-unused-vars": [ | ||
"error", | ||
{ | ||
vars: "all", | ||
args: "after-used", | ||
varsIgnorePattern: "^_", | ||
argsIgnorePattern: "^_", | ||
}, | ||
], | ||
|
||
// avoid TO.DO and FIX.ME comments, create a ticket to track future work | ||
"no-warning-comments": [ | ||
"error", | ||
{ | ||
location: "anywhere", | ||
}, | ||
], | ||
"no-underscore-dangle": [ | ||
"error", | ||
{ | ||
allowAfterThis: true, | ||
}, | ||
], | ||
|
||
// avoid TO.DO and FIX.ME comments, create a ticket to track future work | ||
"no-warning-comments": [ | ||
"error", | ||
{ | ||
location: "anywhere", | ||
}, | ||
], | ||
|
||
"no-unused-expressions": ["error", { enforceForJSX: true }], | ||
"no-param-reassign": "error", | ||
"no-useless-rename": "error", | ||
"object-shorthand": "error", | ||
"prefer-arrow-callback": ["error", { allowNamedFunctions: true }], | ||
"no-unused-expressions": ["error", { enforceForJSX: true }], | ||
"no-param-reassign": "error", | ||
"no-useless-rename": "error", | ||
"object-shorthand": "error", | ||
"prefer-arrow-callback": ["error", { allowNamedFunctions: true }], | ||
}, | ||
}, | ||
}; | ||
]; |
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,6 +1,12 @@ | ||
module.exports = { | ||
extends: ["plugin:jest/recommended"], | ||
rules: { | ||
"jest/consistent-test-it": ["error", { fn: "it" }], | ||
// @ts-ignore | ||
const jest = require("eslint-plugin-jest"); | ||
|
||
/** @type {import("eslint").Linter.Config[]} */ | ||
module.exports = [ | ||
jest.configs["flat/recommended"], | ||
{ | ||
rules: { | ||
"jest/consistent-test-it": ["error", { fn: "it" }], | ||
}, | ||
}, | ||
}; | ||
]; |
Oops, something went wrong.