-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deps: update eslint to v9 add formatting rules and remove unused deps (…
…#4255) * deps: update eslint to v9 add formatting rules and remove unused deps * update github action linting * autofix linting * fix non autofix linting issues * remove vim setting comment * update @vitest/eslint-plugin
- Loading branch information
1 parent
8d6368c
commit 6345964
Showing
1,588 changed files
with
9,172 additions
and
16,034 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
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,138 @@ | ||
import pluginJs from '@eslint/js'; | ||
import pluginHeader from 'eslint-plugin-header'; | ||
import pluginReact from 'eslint-plugin-react'; | ||
import pluginReactHooks from 'eslint-plugin-react-hooks'; | ||
import globals from 'globals'; | ||
import * as importPlugin from 'eslint-plugin-import'; | ||
import vitest from '@vitest/eslint-plugin'; | ||
import allowedSnakeCase from './allowedSnakeCase.js'; | ||
|
||
pluginHeader.rules.header.meta.schema = false; // https://github.com/Stuk/eslint-plugin-header/issues/57 | ||
|
||
export default [ | ||
pluginJs.configs.recommended, | ||
pluginReact.configs.flat?.recommended, | ||
{ | ||
ignores: ['build', 'eslint.config.js'], | ||
}, | ||
{ | ||
files: ['**/*.{js,mjs,cjs,jsx}'], | ||
}, | ||
{ | ||
plugins: { | ||
react: pluginReact, | ||
'react-hooks': pluginReactHooks, | ||
vitest, | ||
import: importPlugin, | ||
header: pluginHeader, | ||
}, | ||
}, | ||
{ | ||
settings: { | ||
react: { | ||
version: 'detect', | ||
}, | ||
}, | ||
languageOptions: { | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
globals: { | ||
...globals.browser, | ||
...globals.node, | ||
describe: 'readonly', | ||
it: 'readonly', | ||
expect: 'readonly', | ||
beforeEach: 'readonly', | ||
afterEach: 'readonly', | ||
beforeAll: 'readonly', | ||
afterAll: 'readonly', | ||
vi: 'readonly', | ||
}, | ||
}, | ||
}, | ||
{ | ||
rules: { | ||
...pluginReactHooks.configs.recommended.rules, | ||
'react/react-in-jsx-scope': 'off', | ||
'react/prop-types': [ | ||
'warn', | ||
{ | ||
ignore: ['children', 'className', 'location'], | ||
}, | ||
], | ||
'no-unused-vars': [ | ||
'warn', | ||
{ | ||
args: 'none', | ||
ignoreRestSiblings: true, | ||
}, | ||
], | ||
camelcase: [ | ||
'warn', | ||
{ | ||
allow: allowedSnakeCase, | ||
properties: 'always', | ||
}, | ||
], | ||
'react/display-name': 'off', | ||
'no-class-assign': 'off', | ||
'no-prototype-builtins': 'off', | ||
'no-case-declarations': 'off', | ||
'react-hooks/exhaustive-deps': 'warn', | ||
'header/header': [ | ||
2, | ||
'block', | ||
[ | ||
{ | ||
pattern: ' SPDX-FileCopyrightText: \\d{4} Greenbone AG', | ||
template: ' SPDX-FileCopyrightText: 2024 Greenbone AG', | ||
}, | ||
' *', | ||
' * SPDX-License-Identifier: AGPL-3.0-or-later', | ||
' ', | ||
], | ||
2, | ||
], | ||
'react/jsx-sort-props': [ | ||
'error', | ||
{ | ||
callbacksLast: true, | ||
shorthandFirst: true, | ||
ignoreCase: false, | ||
reservedFirst: true, | ||
noSortAlphabetically: false, | ||
}, | ||
], | ||
'import/order': [ | ||
'error', | ||
{ | ||
groups: [ | ||
['builtin', 'external'], | ||
['internal'], | ||
['parent', 'sibling', 'index'], | ||
], | ||
'newlines-between': 'always', | ||
alphabetize: { | ||
order: 'asc', | ||
caseInsensitive: true, | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
|
||
{ | ||
files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'], | ||
plugins: {vitest}, | ||
rules: { | ||
...vitest.configs.recommended.rules, | ||
'vitest/no-focused-tests': 'error', | ||
'vitest/no-disabled-tests': 'warn', | ||
'vitest/no-identical-title': 'error', | ||
'react/prop-types': 'off', | ||
}, | ||
}, | ||
]; |
Oops, something went wrong.