webapp/.eslintrc.cjs

109 lines
2.9 KiB
JavaScript
Raw Normal View History

2022-09-09 11:53:35 +00:00
module.exports = {
2024-01-23 16:32:57 +00:00
plugins: ['@typescript-eslint', 'import', 'sonarjs', 'unicorn', 'promise', 'solid', 'jest'],
2022-09-09 11:53:35 +00:00
extends: [
2024-01-23 16:32:57 +00:00
'eslint:recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'prettier',
'plugin:sonarjs/recommended',
'plugin:unicorn/recommended',
'plugin:promise/recommended',
'plugin:solid/recommended',
'plugin:jest/recommended',
2022-09-09 11:53:35 +00:00
],
overrides: [
{
2024-01-23 16:32:57 +00:00
files: ['**/*.ts', '**/*.tsx'],
parser: '@typescript-eslint/parser',
2022-09-09 11:53:35 +00:00
parserOptions: {
ecmaVersion: 2021,
ecmaFeatures: { jsx: true },
2024-01-23 16:32:57 +00:00
sourceType: 'module',
project: './tsconfig.json',
2022-09-09 11:53:35 +00:00
},
extends: [
2024-01-23 16:32:57 +00:00
'plugin:@typescript-eslint/recommended',
2024-01-23 16:44:58 +00:00
// 'plugin:@typescript-eslint/recommended-requiring-type-checking', // 23-01-2024 681 problems
2022-09-09 11:53:35 +00:00
],
rules: {
2024-01-23 16:32:57 +00:00
'@typescript-eslint/no-unused-vars': [
'warn',
2022-09-22 09:37:49 +00:00
{
2024-01-23 16:32:57 +00:00
argsIgnorePattern: '^_',
},
2022-09-22 09:37:49 +00:00
],
2024-01-23 16:32:57 +00:00
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/no-explicit-any': 'warn',
},
},
2022-09-09 11:53:35 +00:00
],
env: {
browser: true,
node: true,
2024-01-23 16:32:57 +00:00
mocha: true,
2022-09-09 11:53:35 +00:00
},
globals: {},
rules: {
2022-11-25 08:19:04 +00:00
// Solid
2024-01-23 16:32:57 +00:00
'solid/reactivity': 'off', // too many 'should be used within JSX'
'solid/no-innerhtml': 'off',
2022-09-09 11:53:35 +00:00
/** Unicorn **/
2024-01-23 16:32:57 +00:00
'unicorn/no-null': 'off',
'unicorn/filename-case': 'off',
'unicorn/no-array-for-each': 'off',
'unicorn/no-array-reduce': 'off',
'unicorn/prefer-string-replace-all': 'warn',
'unicorn/prevent-abbreviations': 'off',
'unicorn/prefer-module': 'off',
'unicorn/import-style': 'off',
'unicorn/numeric-separators-style': 'off',
'unicorn/prefer-node-protocol': 'off',
2024-01-23 16:44:58 +00:00
'unicorn/prefer-dom-node-append': 'warn',
2024-01-23 16:32:57 +00:00
'unicorn/prefer-top-level-await': 'warn',
'unicorn/consistent-function-scoping': 'warn',
'unicorn/no-array-callback-reference': 'warn',
'unicorn/no-array-method-this-argument': 'warn',
'unicorn/no-for-loop': 'off',
2023-05-07 13:47:10 +00:00
2024-01-23 16:32:57 +00:00
'sonarjs/no-duplicate-string': ['warn', { threshold: 5 }],
'sonarjs/prefer-immediate-return': 'warn',
2022-09-09 11:53:35 +00:00
2022-11-25 08:19:04 +00:00
// Promise
2024-01-23 16:32:57 +00:00
'promise/catch-or-return': 'off',
'promise/always-return': 'off',
2022-11-14 17:09:51 +00:00
2024-01-23 16:32:57 +00:00
eqeqeq: 'error',
'no-param-reassign': 'error',
'no-nested-ternary': 'error',
'no-shadow': 'error',
2024-01-23 16:32:57 +00:00
'import/order': [
'warn',
{
groups: ['type', 'builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
distinctGroup: false,
pathGroups: [
{
pattern: '*.scss',
patternOptions: { matchBase: true },
group: 'index',
position: 'after',
},
],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
2022-09-09 11:53:35 +00:00
},
settings: {
2024-01-23 16:32:57 +00:00
'import/resolver': {
2022-09-09 11:53:35 +00:00
typescript: true,
2024-01-23 16:32:57 +00:00
node: true,
},
},
}