Repository navigation
Expand file tree
/
Copy patheslint.config.cjs
More file actions
52 lines (50 loc) · 1.76 KB
/
Copy patheslint.config.cjs
File metadata and controls
52 lines (50 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const js = require('@eslint/js');
const globals = require('globals');
const eslintConfigPrettier = require('eslint-config-prettier');
const eslintPluginPrettier = require('eslint-plugin-prettier');
const sonarjs = require('eslint-plugin-sonarjs');
const eslintPrettierConfigs = Array.isArray(eslintConfigPrettier) ? eslintConfigPrettier : [eslintConfigPrettier];
module.exports = [
{
ignores: ['build/**', 'coverage/**', '.nyc_output/**'],
},
js.configs.recommended,
...eslintPrettierConfigs,
{
files: ['**/*.js'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'commonjs',
globals: {
...globals.node,
},
},
plugins: {
prettier: eslintPluginPrettier,
sonarjs,
},
rules: {
'prettier/prettier': 'warn',
'sonarjs/prefer-single-boolean-return': 'warn',
'no-prototype-builtins': 'warn',
// ESLint 10's recommended rulesets include this as an error; this repo
// currently has a few intentional no-op assignments.
'no-useless-assignment': 'off',
// This project has some variables kept for readability/consistency.
// Downgrade to warnings to avoid failing CI on unused locals.
'no-unused-vars': ['warn', {args: 'none', caughtErrors: 'none'}],
curly: ['error', 'all'],
'sonarjs/no-duplicated-branches': 'warn',
},
},
{
files: ['test/**/*.mjs'],
languageOptions: {
globals: {
...globals.node,
...globals.mocha,
...globals.chai,
},
},
},
];