Skip to content
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

Deps update eslint #4255

Merged
merged 6 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
86 changes: 0 additions & 86 deletions .eslintrc.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/ci-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
- name: Install dependencies
run: npm install
- name: Lint JavaScript files
run: npm run lint -- --format junit -o ${{ env.REPORT_FILE }}
run: npm run lint > ${{ env.REPORT_FILE }}
- name: Store Lint Results
uses: actions/upload-artifact@v4
with:
Expand Down
4 changes: 3 additions & 1 deletion allowedSnakeCase.cjs → allowedSnakeCase.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

module.exports = [
const allowedSnakeCase = [

Check warning on line 6 in allowedSnakeCase.js

View check run for this annotation

Codecov / codecov/patch

allowedSnakeCase.js#L6

Added line #L6 was not covered by tests
'access_hosts',
'action_result',
'actions_column',
Expand Down Expand Up @@ -693,3 +693,5 @@
'yes_no_props',
'zh_TW',
];

export default allowedSnakeCase;

Check warning on line 697 in allowedSnakeCase.js

View check run for this annotation

Codecov / codecov/patch

allowedSnakeCase.js#L696-L697

Added lines #L696 - L697 were not covered by tests
138 changes: 138 additions & 0 deletions eslint.config.js
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',
},
},
];
Loading
Loading