webapp/.eslintrc.js

88 lines
2.4 KiB
JavaScript
Raw Normal View History

2022-09-09 11:53:35 +00:00
module.exports = {
plugins: ['@typescript-eslint', 'import', 'sonarjs', 'unicorn', 'promise', 'solid', 'jest'],
extends: [
'eslint:recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'prettier',
'plugin:sonarjs/recommended',
'plugin:unicorn/recommended',
'plugin:promise/recommended',
'plugin:solid/recommended',
'plugin:jest/recommended'
],
overrides: [
{
files: ['**/*.ts', '**/*.tsx'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2021,
ecmaFeatures: { jsx: true },
sourceType: 'module',
project: './tsconfig.json'
},
extends: [
'plugin:@typescript-eslint/recommended'
// Maybe one day...
// 'plugin:@typescript-eslint/recommended-requiring-type-checking'
],
rules: {
2023-05-01 18:32:32 +00:00
'@typescript-eslint/no-unused-vars': [
2022-09-22 09:37:49 +00:00
'warn',
{
argsIgnorePattern: '^_'
2022-09-22 09:37:49 +00:00
}
],
2022-10-25 16:25:42 +00:00
'@typescript-eslint/no-non-null-assertion': 'error',
// TODO: Remove any usage and enable
'@typescript-eslint/no-explicit-any': 'off'
2022-09-09 11:53:35 +00:00
}
}
],
env: {
browser: true,
node: true,
mocha: true
},
globals: {},
rules: {
2022-11-25 08:19:04 +00:00
// Solid
'solid/reactivity': 'off', // FIXME
2022-09-09 11:53:35 +00:00
'solid/no-innerhtml': 'off',
/** Unicorn **/
'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',
2022-11-25 08:19:04 +00:00
'unicorn/prefer-dom-node-append': 'off', // FIXME
'unicorn/prefer-top-level-await': 'warn',
2022-11-23 12:31:13 +00:00
'unicorn/consistent-function-scoping': 'warn',
2023-05-07 13:47:10 +00:00
'unicorn/no-array-callback-reference': 'warn',
'unicorn/no-array-method-this-argument': 'warn',
'sonarjs/no-duplicate-string': ['warn', { threshold: 5 }],
2022-09-09 11:53:35 +00:00
2022-11-25 08:19:04 +00:00
// Promise
// 'promise/catch-or-return': 'off', // Should be enabled
2022-11-14 17:09:51 +00:00
'promise/always-return': 'off',
2022-09-09 11:53:35 +00:00
eqeqeq: 'error',
'no-param-reassign': 'error',
2022-09-28 20:16:44 +00:00
'no-nested-ternary': 'error',
2023-05-01 18:32:32 +00:00
'no-shadow': 'error'
2022-09-09 11:53:35 +00:00
},
settings: {
'import/resolver': {
typescript: true,
node: true
}
}
}