Repository navigation
Expand file tree
/
Copy patheslint.config.js
More file actions
64 lines (63 loc) · 2.08 KB
/
Copy patheslint.config.js
File metadata and controls
64 lines (63 loc) · 2.08 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
import eslint from '@eslint/js'
import { defineConfig } from 'eslint/config'
import eslintConfigPrettier from 'eslint-config-prettier'
export default defineConfig(
eslint.configs.recommended,
eslintConfigPrettier,
{
// source files only, generated output excluded so a full-repo run stays fast
ignores: ['**/dist/', '**/build/', '**/node_modules/', '**/coverage/', '**/*.min.{js,mjs,cjs}', '**/*.bundle.js'],
},
{
rules: {
'no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
curly: ['error', 'all'],
'no-nested-ternary': 'error',
// none of this `;(expr).method()`. semi: 'never' rules out trailing
// `;`, semi-style: 'last' rules out leading `;`. together they force a
// restructure (extract temp, fix the underlying cast, etc.) rather than
// letting a defender semi slip in
semi: ['error', 'never', { beforeStatementContinuationChars: 'never' }],
'semi-style': ['error', 'last'],
'no-extra-semi': 'error',
},
},
{
files: ['**/*.cjs'],
languageOptions: {
globals: {
module: 'writable',
require: 'readonly',
exports: 'writable',
__dirname: 'readonly',
__filename: 'readonly',
process: 'readonly',
},
},
},
{
files: ['src/**/*.{js,cjs,mjs}', '**/scripts/**/*.{js,mjs,cjs}', 'docs/**/*.js', '*.config.js'],
languageOptions: {
globals: {
process: 'readonly',
console: 'readonly',
Buffer: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
// node 22+ web globals, eslint doesn't infer this from package.json engines
URLSearchParams: 'readonly',
URL: 'readonly',
fetch: 'readonly',
setTimeout: 'readonly',
clearTimeout: 'readonly',
setInterval: 'readonly',
clearInterval: 'readonly',
// base64/text codecs used by the decode pipeline, global in node and browsers
atob: 'readonly',
btoa: 'readonly',
TextEncoder: 'readonly',
TextDecoder: 'readonly',
},
},
},
)