-
Notifications
You must be signed in to change notification settings - Fork 29.6k
/
eslint.config_partial.mjs
54 lines (50 loc) · 1.44 KB
/
eslint.config_partial.mjs
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
import {
noRestrictedSyntaxCommonAll,
noRestrictedSyntaxCommonLib,
requireEslintTool,
} from '../tools/eslint/eslint.config_utils.mjs';
import { builtinModules as builtin } from 'node:module';
const globals = requireEslintTool('globals');
export default [
{
files: ['doc/**/*.md/*.{js,mjs,cjs}'],
rules: {
// Ease some restrictions in doc examples.
'no-restricted-properties': 'off',
'no-restricted-syntax': [
'error',
...noRestrictedSyntaxCommonAll,
...noRestrictedSyntaxCommonLib,
{
selector: `CallExpression[callee.name="require"][arguments.0.type="Literal"]:matches(${builtin.map((name) => `[arguments.0.value="${name}"]`).join(',')}),ImportDeclaration:matches(${builtin.map((name) => `[source.value="${name}"]`).join(',')})`,
message: 'Use `node:` prefix.',
},
],
'no-undef': 'off',
'no-unused-expressions': 'off',
'no-unused-vars': 'off',
'symbol-description': 'off',
// Add new ECMAScript features gradually.
'prefer-const': 'error',
'prefer-rest-params': 'error',
'prefer-template': 'error',
// Stylistic rules.
'@stylistic/js/no-multiple-empty-lines': [
'error',
{
max: 1,
maxEOF: 0,
maxBOF: 0,
},
],
},
},
{
files: ['doc/api_assets/*.js'],
languageOptions: {
globals: {
...globals.browser,
},
},
},
];