Repository navigation
Expand file tree
/
Copy patheslint.config.js
More file actions
97 lines (95 loc) · 2.61 KB
/
Copy patheslint.config.js
File metadata and controls
97 lines (95 loc) · 2.61 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
'use strict';
const js = require('@eslint/js');
const globals = require('globals');
const stylistic = require('@stylistic/eslint-plugin');
module.exports = [
{
ignores: ['encoding.js', 'encoding.min.js']
},
js.configs.recommended,
{
linterOptions: {
reportUnusedDisableDirectives: 'error'
},
plugins: {
'@stylistic': stylistic
},
languageOptions: {
// Use "ecmaVersion: 5" because the source is hand-written in ES5
// without any transpilation and released as-is.
ecmaVersion: 5,
sourceType: 'script',
parserOptions: {
ecmaFeatures: {
globalReturn: true,
// Keep the source compatible with strict mode for ESM bundling
impliedStrict: true
}
},
globals: {
...globals.es2015,
...globals.browser,
...globals.node
}
},
rules: {
'@stylistic/comma-dangle': ['error', 'never'],
'@stylistic/indent': [
'error',
2,
{
ArrayExpression: 1,
ignoreComments: true,
ignoredNodes: ['ConditionalExpression'],
MemberExpression: 1,
ObjectExpression: 1,
outerIIFEBody: 'off',
SwitchCase: 1,
VariableDeclarator: 'first'
}
],
'@stylistic/key-spacing': [
'error',
{
beforeColon: false,
afterColon: true
}
],
'@stylistic/keyword-spacing': 'error',
'@stylistic/max-len': [
'error',
{
code: 120,
tabWidth: 2,
ignoreUrls: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreRegExpLiterals: true
}
],
'@stylistic/no-mixed-spaces-and-tabs': 'error',
'@stylistic/no-multiple-empty-lines': ['error', { max: 2 }],
'@stylistic/no-tabs': 'error',
'@stylistic/object-curly-spacing': ['error', 'always', { objectsInObjects: false }],
'@stylistic/quotes': ['error', 'single', { allowTemplateLiterals: 'always', avoidEscape: true }],
'@stylistic/quote-props': ['error', 'consistent-as-needed', { keywords: true }],
'@stylistic/semi': 'error',
'@stylistic/space-infix-ops': 'error',
'@stylistic/space-unary-ops': 'error',
'no-console': 'warn',
'no-empty': 'off',
'no-undef': 'error',
'no-unused-vars': ['error', { args: 'none', caughtErrors: 'none' }],
'no-useless-escape': 'warn'
}
},
{
files: ['tests/**/*.js', 'eslint.config.js'],
languageOptions: {
ecmaVersion: 2022,
globals: {
...globals.mocha
}
}
}
];