forked from emberjs/ember.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
179 lines (162 loc) · 4.45 KB
/
.eslintrc.js
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
const path = require('path');
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
reportUnusedDisableDirectives: true,
extends: [
'eslint:recommended',
'plugin:import/errors',
'plugin:import/typescript',
'plugin:qunit/recommended',
'plugin:prettier/recommended',
],
plugins: ['ember-internal', 'import', 'qunit', 'disable-features'],
rules: {
'no-console': 'error',
'no-implicit-coercion': 'error',
'no-new-wrappers': 'error',
'no-unused-vars': 'error',
'no-throw-literal': 'error',
'no-var': 'error',
'qunit/no-assert-equal': 'off',
'qunit/no-commented-tests': 'off',
'qunit/require-expect': 'off',
'disable-features/disable-async-await': 'error',
'disable-features/disable-generator-functions': 'error',
},
settings: {
'import/core-modules': ['require', 'backburner', 'router', '@glimmer/interfaces'],
'import/resolver': {
node: {
extensions: ['.js', '.ts', '.d.ts'],
paths: [path.resolve('./packages/')],
},
},
},
overrides: [
{
files: ['*.ts'],
extends: ['plugin:@typescript-eslint/recommended'],
parserOptions: {
sourceType: 'module',
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
rules: {
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-this-alias': 'off',
'@typescript-eslint/no-var-requires': 'warn',
'@typescript-eslint/consistent-type-imports': 'error',
// TODO: Enable and fix these rules
// Typescript provides better types with these rules enabled
'prefer-spread': 'off',
'prefer-const': 'off',
'prefer-rest-params': 'off',
},
},
{
// TODO: files: ['packages/**/*.[jt]s'],
files: ['packages/**/*.js'],
parserOptions: {
ecmaVersion: 2017,
sourceType: 'module',
},
globals: {
// A safe subset of 'browser:true':
window: true,
document: true,
setTimeout: true,
clearTimeout: true,
setInterval: true,
clearInterval: true,
console: true,
Map: true,
Set: true,
Symbol: true,
WeakMap: true,
Event: true,
},
rules: {
'ember-internal/require-yuidoc-access': 'error',
'ember-internal/no-const-outside-module-scope': 'error',
},
},
{
files: [
'packages/*/tests/**/*.[jt]s',
'packages/@ember/*/tests/**/*.[jt]s',
'packages/@ember/-internals/*/tests/**/*.[jt]s',
'packages/internal-test-helpers/**/*.[jt]s',
],
env: {
qunit: true,
},
globals: {
expectAssertion: true,
expectDeprecation: true,
expectDeprecationAsync: true,
expectNoDeprecation: true,
expectWarning: true,
expectNoWarning: true,
ignoreAssertion: true,
ignoreDeprecation: true,
},
rules: {
'disable-features/disable-async-await': 'off',
'disable-features/disable-generator-functions': 'off',
},
},
{
// matches all node-land files
files: [
'.eslintrc.js',
'node-tests/**/*.js',
'tests/node/**/*.js',
'blueprints/**/*.js',
'blueprints-js/**/*.js',
'bin/**/*.js',
'tests/docs/*.js',
'config/**/*.js',
'lib/**/*.js',
'server/**/*.js',
'testem.js',
'testem.ci-browsers.js',
'testem.browserstack.js',
'd8-runner.js',
'broccoli/**/*.js',
'ember-cli-build.js',
'rollup.config.js',
],
parserOptions: {
ecmaVersion: 2018,
sourceType: 'script',
},
env: {
node: true,
es6: true,
},
plugins: ['node'],
rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, {
// add your custom rules and overrides for node files here
'no-process-exit': 'off',
'no-throw-literal': 'error',
'disable-features/disable-async-await': 'off',
'disable-features/disable-generator-functions': 'off',
}),
},
{
files: ['node-tests/**/*.js'],
env: {
mocha: true,
},
},
{
files: ['tests/docs/**/*.js', 'tests/node/**/*.js'],
env: {
qunit: true,
},
},
],
};