-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update to eslint 9 + flat config (#9)
- Loading branch information
1 parent
2f5f2f1
commit e59aadc
Showing
11 changed files
with
2,830 additions
and
4,005 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
on: | ||
on: | ||
push: | ||
branches: | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
|
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 @@ | ||
* https://eslint.org/docs/latest/extend/shareable-configs |
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,104 @@ | ||
import babelParser from "@babel/eslint-parser"; | ||
import js from "@eslint/js"; | ||
import eslintPluginImportX from "eslint-plugin-import-x"; | ||
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended"; | ||
import eslintPluginSimpleImportSort from "eslint-plugin-simple-import-sort"; | ||
import eslintPluginUnusedImports from "eslint-plugin-unused-imports"; | ||
import globals from "globals"; | ||
|
||
export default [ | ||
js.configs.recommended, | ||
eslintPluginPrettierRecommended, | ||
{ | ||
languageOptions: { | ||
ecmaVersion: "latest", | ||
sourceType: "module", | ||
parser: babelParser, | ||
parserOptions: { | ||
requireConfigFile: false, | ||
}, | ||
globals: { | ||
...globals.browser, | ||
...globals.node, | ||
}, | ||
}, | ||
plugins: { | ||
"simple-import-sort": eslintPluginSimpleImportSort, | ||
import: eslintPluginImportX, | ||
"unused-imports": eslintPluginUnusedImports, | ||
}, | ||
rules: { | ||
// error prevention | ||
"array-callback-return": ["error", { checkForEach: true }], | ||
"no-await-in-loop": "error", | ||
"no-constant-binary-expression": "error", | ||
"no-constructor-return": "error", | ||
"no-promise-executor-return": "error", | ||
"no-self-compare": "error", | ||
"no-template-curly-in-string": "error", | ||
"no-unmodified-loop-condition": "error", | ||
"no-unreachable-loop": "error", | ||
"no-unused-private-class-members": "error", | ||
"no-use-before-define": [ | ||
"error", | ||
{ | ||
functions: false, | ||
classes: true, | ||
variables: true, | ||
allowNamedExports: false, | ||
}, | ||
], | ||
"require-atomic-updates": "error", | ||
|
||
// good practises | ||
camelcase: ["error", { properties: "never" }], | ||
eqeqeq: "error", | ||
"new-cap": ["error", { capIsNew: false }], | ||
"no-array-constructor": "error", | ||
"no-console": ["error", { allow: ["error"] }], | ||
"no-else-return": ["error", { allowElseIf: false }], | ||
"no-extend-native": "error", | ||
"no-lonely-if": "error", | ||
"no-param-reassign": "error", | ||
"no-return-assign": "error", | ||
"no-throw-literal": "error", | ||
"no-var": "error", | ||
"object-shorthand": "error", | ||
"prefer-const": "error", | ||
"prefer-rest-params": "error", | ||
"prefer-spread": "error", | ||
"prefer-template": "error", | ||
radix: "error", | ||
yoda: "error", | ||
|
||
// style | ||
curly: "error", | ||
"lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }], | ||
"padding-line-between-statements": [ | ||
"error", | ||
{ blankLine: "always", prev: "*", next: "return" }, | ||
], | ||
|
||
// plugins | ||
"import/first": "error", | ||
"import/newline-after-import": "error", | ||
"import/no-duplicates": "error", | ||
"import/no-unresolved": "error", | ||
"import/no-webpack-loader-syntax": "error", | ||
"prettier/prettier": ["error", { printWidth: 100, useTabs: true }], | ||
"simple-import-sort/exports": "error", | ||
"simple-import-sort/imports": "error", | ||
"unused-imports/no-unused-imports": "error", | ||
"no-unused-vars": "off", | ||
"unused-imports/no-unused-vars": [ | ||
"warn", | ||
{ | ||
vars: "all", | ||
varsIgnorePattern: "^_", | ||
args: "after-used", | ||
argsIgnorePattern: "^_", | ||
}, | ||
], | ||
}, | ||
}, | ||
]; |
Oops, something went wrong.