-
Notifications
You must be signed in to change notification settings - Fork 85
Expand file tree
/
Copy patheslint.config.js
More file actions
144 lines (141 loc) · 3.81 KB
/
Copy patheslint.config.js
File metadata and controls
144 lines (141 loc) · 3.81 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
// Shared ESLint flat config for the XStreamRoll monorepo.
// Uses @typescript-eslint for TypeScript parsing across all packages.
// Plugin: eslint-plugin-import for `import/order` enforcement (#403).
const ignores = [
"**/node_modules/**",
"**/dist/**",
"**/dist-esm/**",
"**/build/**",
"**/.next/**",
"**/coverage/**",
"**/*.d.ts",
"**/*.config.js",
"**/*.config.mjs",
"**/next-env.d.ts",
"**/stryker-tmp/**",
]
const tsParser = require("@typescript-eslint/parser")
const tsPlugin = require("@typescript-eslint/eslint-plugin")
const importPlugin = require("eslint-plugin-import")
module.exports = [
{
ignores,
},
{
files: ["**/*.{ts,tsx}"],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 2022,
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
globals: {
// Node
process: "readonly",
console: "readonly",
Buffer: "readonly",
__dirname: "readonly",
__filename: "readonly",
module: "readonly",
require: "readonly",
exports: "readonly",
global: "readonly",
// Browser / DOM
window: "readonly",
document: "readonly",
navigator: "readonly",
fetch: "readonly",
crypto: "readonly",
Response: "readonly",
RequestInit: "readonly",
Request: "readonly",
// Common test
describe: "readonly",
it: "readonly",
test: "readonly",
expect: "readonly",
beforeEach: "readonly",
afterEach: "readonly",
beforeAll: "readonly",
afterAll: "readonly",
jest: "readonly",
},
},
plugins: {
"@typescript-eslint": tsPlugin,
import: importPlugin,
},
settings: {
"import/resolver": {
node: {
extensions: [".js", ".jsx", ".ts", ".tsx", ".mjs", ".cjs"],
},
},
},
rules: {
...tsPlugin.configs.recommended.rules,
"@typescript-eslint/no-unused-vars": [
"warn",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
],
"@typescript-eslint/no-explicit-any": "warn",
"no-console": "off",
eqeqeq: ["error", "always", { null: "ignore" }],
// Issue #403: enforce consistent import ordering across the
// monorepo. Groups run in order so a missing newline gap is
// flagged consistently. `newlines-between: "always"` mirrors
// the gap style used in this codebase.
//
// Set to "warn" rather than "error" so a passing lint is the
// natural CI signal but existing files that haven't been
// autofixed won't block the pipeline — `npm run lint:fix`
// applies the fix in-place. Over time we will tighten this
// to "error" once the codebase is fully ordered.
"import/order": [
"warn",
{
groups: [
"builtin",
"external",
"internal",
["parent", "sibling", "index"],
"type",
],
"newlines-between": "always",
alphabetize: {
order: "asc",
caseInsensitive: true,
},
},
],
},
},
{
files: ["**/*.{js,jsx,mjs,cjs}"],
languageOptions: {
ecmaVersion: 2022,
sourceType: "module",
globals: {
process: "readonly",
console: "readonly",
module: "readonly",
require: "readonly",
exports: "readonly",
__dirname: "readonly",
__filename: "readonly",
global: "readonly",
},
},
rules: {
"no-unused-vars": "off",
"no-undef": "off",
"no-empty": ["warn", { allowEmptyCatch: true }],
"no-console": "off",
"prefer-const": "warn",
eqeqeq: ["error", "always", { null: "ignore" }],
},
},
]