-
Notifications
You must be signed in to change notification settings - Fork 191
/
.eslintrc.cjs
138 lines (132 loc) · 3.62 KB
/
.eslintrc.cjs
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
// @ts-check
const { resolve } = require('path');
const cjsTsconfig = resolve(__dirname, 'tsconfig.cjs.json');
/** @type {import("eslint").Linter.Config} */
module.exports = {
root: true,
reportUnusedDisableDirectives: true,
extends: [],
ignorePatterns: [
'dist',
'ts-dist',
'node_modules',
'tmp',
'**/node_modules',
'**/dist',
'**/fixtures',
'!**/.eslintrc.cjs',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
project: [],
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.js', '.cjs', '.mjs', '.mts', '.ts', '.d.ts'],
},
'import/core-modules': ['@glimmer/debug'],
'import/resolver': {
typescript: {},
},
node: {
allowModules: ['@glimmer/debug', '@glimmer/local-debug-flags'],
tryExtensions: ['.js', '.ts', '.d.ts', '.json'],
},
},
plugins: [
'@typescript-eslint',
'prettier',
'qunit',
'simple-import-sort',
'unused-imports',
'prettier',
'n',
],
rules: {},
overrides: [
{
files: ['.eslintrc.cjs', '**/.eslintrc.cjs'],
parserOptions: {
project: [cjsTsconfig],
},
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:import/errors',
'plugin:import/typescript',
'plugin:qunit/recommended',
'prettier',
],
rules: {
'@typescript-eslint/no-var-requires': 'off',
},
},
{
files: ['./package.json', '**/package.json'],
parser: 'jsonc-eslint-parser',
extends: ['plugin:jsonc/recommended-with-json', 'plugin:jsonc/prettier'],
rules: {
// Enforce order in the scripts object
// https://ota-meshi.github.io/eslint-plugin-jsonc/rules/sort-keys.html
'jsonc/sort-keys': [
'error',
{
pathPattern: '^$',
order: [
'name',
'version',
'license',
'description',
'repository',
'author',
'type',
'main',
'types',
'module',
'exports',
'publishConfig',
'files',
'scripts',
'dependencies',
'peerDependencies',
'devDependencies',
'release-it',
'changelog',
'engines',
'volta',
],
},
{
pathPattern:
'scripts|devDependencies|peerDependencies|optionalDependencies|pnpm|overrides|peerDependencyRules|patchedDependencies|dependenciesMeta',
order: { type: 'asc' },
},
// ...
],
},
},
{
// these packages need to be fixed to avoid these warnings, but in the
// meantime we should not regress the other packages
files: [
// this specific test imports from @glimmer/runtime (causing a cyclic
// dependency), it should either be refactored to use the interfaces
// directly (instead of the impls) or moved into @glimmer/runtime
'packages/@glimmer/reference/test/template-test.ts',
],
rules: {
'n/no-extraneous-import': 'warn',
},
},
// QUnit is a weird package, and there are some issues open about fixing it
// - https://github.com/qunitjs/qunit/issues/1729
// - https://github.com/qunitjs/qunit/issues/1727
// - https://github.com/qunitjs/qunit/issues/1724
{
files: ['**/*-test.ts', '**/{test,integration-tests}/**/*.ts'],
rules: {
'@typescript-eslint/unbound-method': 'off',
},
},
],
};