Repository navigation
Expand file tree
/
Copy patheslint.config.mjs
More file actions
88 lines (87 loc) · 2.78 KB
/
Copy patheslint.config.mjs
File metadata and controls
88 lines (87 loc) · 2.78 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
import js from '@eslint/js'
import { fileURLToPath } from 'node:url'
import globals from 'globals'
import markdown from 'eslint-plugin-markdown'
import jsonPlugin from 'eslint-plugin-json'
import mochaPlugin from 'eslint-plugin-mocha'
import nPlugin from 'eslint-plugin-n'
import promisePlugin from 'eslint-plugin-promise'
import eslintPluginPlugin from 'eslint-plugin-eslint-plugin'
import chaiFriendly from 'eslint-plugin-chai-friendly'
import importPlugin from 'eslint-plugin-import'
import tseslint from 'typescript-eslint'
export default [
{
ignores: ['coverage/**', 'nyc_output/**', 'dist/**', 'docs/**']
},
js.configs.recommended,
...tseslint.configs.recommended,
{
// typescript-eslint's recommended rules are not files-scoped and would
// also hit plain JS; keep JS (tests, markdown examples) on the old rules.
files: ['**/*.js'],
rules: {
'@typescript-eslint/no-require-imports': 'off'
}
},
{
plugins: {
import: importPlugin
},
languageOptions: {
parserOptions: importPlugin.configs.recommended.parserOptions
},
rules: importPlugin.configs.recommended.rules
},
{
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'commonjs',
globals: {
...globals.node,
...globals.mocha
}
}
},
nPlugin.configs['flat/recommended'],
promisePlugin.configs['flat/recommended'],
eslintPluginPlugin.configs.recommended,
mochaPlugin.configs.recommended,
chaiFriendly.configs.recommendedFlat,
...markdown.configs.recommended,
jsonPlugin.configs.recommended,
{
files: ['test/*.js'],
rules: {
'n/no-unpublished-require': 'off'
}
},
{
// Markdown code blocks contain documentation examples that reference
// packages (pem itself, express) not installed in this project.
files: ['**/*.md/*.js'],
rules: {
'n/no-missing-require': 'off',
'n/no-process-exit': 'off',
'n/no-unpublished-require': 'off'
}
},
{
// The TS compiler (tsc with noEmitOnError) is the module-resolution gate
// for lib TS files; the import/n resolvers cannot resolve .ts siblings
// and would false-positive from U2 onward.
files: ['lib/**/*.ts'],
rules: {
'import/no-unresolved': 'off',
'n/no-missing-require': 'off',
// Conversions keep node builtins as import-equals / verbatim require() for identical CJS emit.
'@typescript-eslint/no-require-imports': 'off',
// Behavior-identical conversions need `any` where the JS coerces arbitrary inputs; casts are banned.
'@typescript-eslint/no-explicit-any': 'off',
// var is preserved verbatim by design (R11); --fix must not rewrite it.
'no-var': 'off',
// Same design rule as no-var: master's declarations stay as written.
'prefer-const': 'off'
}
}
]