-
-
Notifications
You must be signed in to change notification settings - Fork 316
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #438 from Novage/feat/eslint9
ESLint 9 and more strict checks
- Loading branch information
Showing
68 changed files
with
941 additions
and
544 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// @ts-check | ||
|
||
import tsEslint from "typescript-eslint"; | ||
import { CommonReactConfig } from "../eslint.common.react.config.js"; | ||
|
||
export default tsEslint.config(...CommonReactConfig); |
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
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 |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import globals from "globals"; | ||
import eslint from "@eslint/js"; | ||
import tsEslint from "typescript-eslint"; | ||
import { flatConfigs as importPlugin } from "eslint-plugin-import"; | ||
|
||
export const CommonConfig = | ||
/** @type {(typeof tsEslint.configs.eslintRecommended)[]} */ ([ | ||
eslint.configs.recommended, | ||
importPlugin.recommended, | ||
tsEslint.configs.eslintRecommended, | ||
...tsEslint.configs.strictTypeChecked, | ||
...tsEslint.configs.stylisticTypeChecked, | ||
{ | ||
languageOptions: { | ||
globals: { | ||
...globals.browser, | ||
}, | ||
|
||
ecmaVersion: 2022, | ||
sourceType: "module", | ||
|
||
parserOptions: { | ||
project: ["tsconfig.json", "tsconfig.node.json"], | ||
}, | ||
}, | ||
|
||
rules: { | ||
"@typescript-eslint/consistent-type-definitions": "off", | ||
"@typescript-eslint/no-unused-vars": [ | ||
"warn", | ||
{ argsIgnorePattern: "^_" }, | ||
], | ||
"@typescript-eslint/restrict-template-expressions": [ | ||
"error", | ||
{ allowNumber: true }, | ||
], | ||
"@typescript-eslint/no-confusing-void-expression": [ | ||
"error", | ||
{ ignoreArrowShorthand: true }, | ||
], | ||
"@typescript-eslint/no-unnecessary-condition": [ | ||
"error", | ||
{ allowConstantLoopConditions: true }, | ||
], | ||
|
||
"no-var": "error", | ||
"no-alert": "warn", | ||
"prefer-const": "error", | ||
"prefer-spread": "error", | ||
"no-multi-assign": "error", | ||
"prefer-template": "error", | ||
"object-shorthand": "error", | ||
"no-nested-ternary": "error", | ||
"no-array-constructor": "error", | ||
"prefer-object-spread": "error", | ||
"prefer-arrow-callback": "error", | ||
"prefer-destructuring": ["error", { object: true, array: false }], | ||
"no-console": "warn", | ||
curly: ["warn", "multi-line", "consistent"], | ||
"no-debugger": "warn", | ||
"spaced-comment": ["warn", "always", { markers: ["/"] }], | ||
|
||
"import/no-unresolved": "off", | ||
"import/named": "off", | ||
"import/no-named-as-default": "off", | ||
"import/namespace": "off", | ||
"import/no-named-as-default-member": "off", | ||
"import/extensions": [ | ||
"error", | ||
"always", | ||
{ | ||
js: "ignorePackages", | ||
jsx: "never", | ||
ts: "never", | ||
tsx: "never", | ||
}, | ||
], | ||
}, | ||
}, | ||
]); |
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,30 @@ | ||
import { CommonConfig } from "./eslint.common.config.js"; | ||
import reactRefresh from "eslint-plugin-react-refresh"; | ||
import reactHooks from "eslint-plugin-react-hooks"; | ||
import reactPlugin from "eslint-plugin-react"; | ||
import react from "@eslint-react/eslint-plugin"; | ||
|
||
export const CommonReactConfig = /** @type {typeof CommonConfig} */ ([ | ||
...CommonConfig, | ||
reactPlugin.configs.flat?.recommended, | ||
reactPlugin.configs.flat?.["jsx-runtime"], | ||
react.configs.all, | ||
{ | ||
plugins: { | ||
"react-hooks": reactHooks, | ||
"react-refresh": reactRefresh, | ||
}, | ||
rules: { | ||
...reactHooks.configs.recommended.rules, | ||
"import/extensions": "off", | ||
"@eslint-react/avoid-shorthand-fragment": "off", | ||
"@eslint-react/avoid-shorthand-boolean": "off", | ||
"@eslint-react/naming-convention/filename": "off", | ||
}, | ||
settings: { | ||
react: { | ||
version: "detect", | ||
}, | ||
}, | ||
}, | ||
]); |
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 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// @ts-check | ||
|
||
import { CommonConfig } from "../../eslint.common.config.js"; | ||
import tsEslint from "typescript-eslint"; | ||
|
||
export default tsEslint.config(...CommonConfig); |
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.