-
Notifications
You must be signed in to change notification settings - Fork 187
/
.eslintrc.cjs
110 lines (105 loc) · 3 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
// @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',
],
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',
},
},
],
};