@appium/eslint-config-appium-ts 2.0.5 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -1
- package/index.mjs +83 -119
- package/package.json +9 -6
package/README.md
CHANGED
|
@@ -13,7 +13,21 @@ Install the package:
|
|
|
13
13
|
npm install @appium/eslint-config-appium-ts --save-dev
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Then add it to your `eslint.config.mjs` file:
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
import appiumConfig from '@appium/eslint-config-appium-ts';
|
|
20
|
+
import {defineConfig} from 'eslint/config';
|
|
21
|
+
|
|
22
|
+
export default defineConfig([
|
|
23
|
+
{
|
|
24
|
+
extends: [appiumConfig],
|
|
25
|
+
// add any other config changes
|
|
26
|
+
},
|
|
27
|
+
]);
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Or for ESLint `< 9.22.0`:
|
|
17
31
|
|
|
18
32
|
```js
|
|
19
33
|
import appiumConfig from '@appium/eslint-config-appium-ts';
|
package/index.mjs
CHANGED
|
@@ -3,29 +3,27 @@ import fs from 'node:fs';
|
|
|
3
3
|
|
|
4
4
|
import {includeIgnoreFile} from '@eslint/compat';
|
|
5
5
|
import js from '@eslint/js';
|
|
6
|
+
import stylistic from '@stylistic/eslint-plugin';
|
|
7
|
+
import {defineConfig, globalIgnores} from 'eslint/config';
|
|
6
8
|
import eslintConfigPrettier from 'eslint-config-prettier';
|
|
9
|
+
import {createTypeScriptImportResolver} from 'eslint-import-resolver-typescript';
|
|
7
10
|
import globals from 'globals';
|
|
8
11
|
import pluginPromise from 'eslint-plugin-promise';
|
|
9
|
-
import
|
|
12
|
+
import {importX} from 'eslint-plugin-import-x';
|
|
10
13
|
import mochaPlugin from 'eslint-plugin-mocha';
|
|
11
|
-
import
|
|
14
|
+
import nodePlugin from 'eslint-plugin-n';
|
|
15
|
+
import {configs as tsConfigs} from 'typescript-eslint';
|
|
16
|
+
import unicorn from 'eslint-plugin-unicorn';
|
|
12
17
|
|
|
13
18
|
const gitignorePath = path.resolve(process.cwd(), '.gitignore');
|
|
14
19
|
|
|
15
|
-
export default [
|
|
16
|
-
js.configs.recommended,
|
|
17
|
-
eslintConfigPrettier,
|
|
18
|
-
pluginPromise.configs['flat/recommended'],
|
|
19
|
-
importPlugin.flatConfigs.recommended,
|
|
20
|
-
...tsConfigs.recommended,
|
|
21
|
-
|
|
20
|
+
export default defineConfig([
|
|
22
21
|
{
|
|
23
22
|
name: 'Script Files',
|
|
24
23
|
files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'],
|
|
25
24
|
languageOptions: {
|
|
26
25
|
ecmaVersion: 2022,
|
|
27
26
|
sourceType: 'module',
|
|
28
|
-
parser: tsParser,
|
|
29
27
|
globals: {
|
|
30
28
|
...globals.node,
|
|
31
29
|
NodeJS: 'readonly',
|
|
@@ -33,22 +31,51 @@ export default [
|
|
|
33
31
|
},
|
|
34
32
|
},
|
|
35
33
|
plugins: {
|
|
36
|
-
'@
|
|
34
|
+
'@stylistic': stylistic,
|
|
35
|
+
'import-x': importX,
|
|
36
|
+
js,
|
|
37
|
+
n: nodePlugin,
|
|
38
|
+
promise: pluginPromise,
|
|
39
|
+
unicorn
|
|
37
40
|
},
|
|
41
|
+
extends: [
|
|
42
|
+
'js/recommended',
|
|
43
|
+
'promise/flat/recommended',
|
|
44
|
+
'import-x/flat/recommended',
|
|
45
|
+
tsConfigs.recommended,
|
|
46
|
+
eslintConfigPrettier,
|
|
47
|
+
],
|
|
38
48
|
settings: {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
*/
|
|
42
|
-
'import/parsers': {
|
|
43
|
-
'@typescript-eslint/parser': ['.ts', '.tsx', '.mtsx'],
|
|
44
|
-
},
|
|
45
|
-
'import/resolver': {
|
|
46
|
-
typescript: {
|
|
49
|
+
'import-x/resolver-next': [
|
|
50
|
+
createTypeScriptImportResolver({
|
|
47
51
|
project: ['tsconfig.json', './packages/*/tsconfig.json'],
|
|
48
|
-
}
|
|
49
|
-
|
|
52
|
+
})
|
|
53
|
+
],
|
|
50
54
|
},
|
|
51
55
|
rules: {
|
|
56
|
+
'@stylistic/array-bracket-spacing': 'error',
|
|
57
|
+
'@stylistic/arrow-parens': 'warn',
|
|
58
|
+
'@stylistic/arrow-spacing': 'error',
|
|
59
|
+
'@stylistic/comma-spacing': 'error',
|
|
60
|
+
'@stylistic/key-spacing': 'error',
|
|
61
|
+
'@stylistic/keyword-spacing': 'error',
|
|
62
|
+
'@stylistic/no-multi-spaces': 'error',
|
|
63
|
+
'@stylistic/no-trailing-spaces': 'error',
|
|
64
|
+
'@stylistic/no-whitespace-before-property': 'error',
|
|
65
|
+
'@stylistic/quotes': [
|
|
66
|
+
'error',
|
|
67
|
+
'single',
|
|
68
|
+
{
|
|
69
|
+
avoidEscape: true,
|
|
70
|
+
allowTemplateLiterals: 'always',
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
'@stylistic/semi': 'error',
|
|
74
|
+
'@stylistic/space-before-blocks': 'error',
|
|
75
|
+
'@stylistic/space-in-parens': 'error',
|
|
76
|
+
'@stylistic/space-infix-ops': 'error',
|
|
77
|
+
'@stylistic/space-unary-ops': 'error',
|
|
78
|
+
|
|
52
79
|
/**
|
|
53
80
|
* This rule is configured to warn if a `@ts-ignore` or `@ts-expect-error` directive is used
|
|
54
81
|
* without explanation.
|
|
@@ -71,7 +98,6 @@ export default [
|
|
|
71
98
|
* @remarks This is because empty interfaces have a use case in declaration merging. Otherwise,
|
|
72
99
|
* an empty interface can be a type alias, e.g., `type Foo = Bar` where `Bar` is an interface.
|
|
73
100
|
*/
|
|
74
|
-
'@typescript-eslint/no-empty-interface': 'off',
|
|
75
101
|
'@typescript-eslint/no-empty-object-type': 'off',
|
|
76
102
|
/**
|
|
77
103
|
* Explicit `any` types are allowed.
|
|
@@ -93,76 +119,28 @@ export default [
|
|
|
93
119
|
* Sometimes we want unused variables to be present in base class method declarations.
|
|
94
120
|
*/
|
|
95
121
|
'@typescript-eslint/no-unused-vars': 'warn',
|
|
96
|
-
'@typescript-eslint/no-var-requires': 'off',
|
|
97
122
|
|
|
98
|
-
'import/
|
|
99
|
-
'import/
|
|
100
|
-
'import/no-duplicates': 2,
|
|
101
|
-
'import/no-unresolved': 2,
|
|
123
|
+
'import-x/named': 'warn',
|
|
124
|
+
'import-x/no-duplicates': 'error',
|
|
102
125
|
|
|
103
|
-
'
|
|
104
|
-
/**
|
|
105
|
-
* Allow native `Promise`s.
|
|
106
|
-
* @remarks Originally, this was so that we could use [bluebird](https://npm.im/bluebird)
|
|
107
|
-
* everywhere, but this is not strictly necessary.
|
|
108
|
-
*/
|
|
109
|
-
'promise/no-native': 'off',
|
|
110
|
-
'promise/no-return-wrap': 1,
|
|
111
|
-
'promise/prefer-await-to-callbacks': 1,
|
|
112
|
-
'promise/prefer-await-to-then': 1,
|
|
113
|
-
'promise/param-names': 1,
|
|
126
|
+
'n/no-deprecated-api': 'warn',
|
|
114
127
|
|
|
115
|
-
'
|
|
116
|
-
'
|
|
117
|
-
'
|
|
118
|
-
'
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
'
|
|
125
|
-
'
|
|
126
|
-
'
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
},
|
|
132
|
-
],
|
|
133
|
-
'curly': [2, 'all'],
|
|
134
|
-
'dot-notation': 2,
|
|
135
|
-
'eqeqeq': [2, 'smart'],
|
|
136
|
-
'key-spacing': [
|
|
137
|
-
2,
|
|
138
|
-
{
|
|
139
|
-
mode: 'strict',
|
|
140
|
-
beforeColon: false,
|
|
141
|
-
afterColon: true,
|
|
142
|
-
},
|
|
143
|
-
],
|
|
144
|
-
'keyword-spacing': 2,
|
|
145
|
-
'no-buffer-constructor': 1,
|
|
146
|
-
'no-console': 2,
|
|
147
|
-
'no-dupe-class-members': 'off',
|
|
148
|
-
'no-empty': 0,
|
|
149
|
-
'no-multi-spaces': 2,
|
|
150
|
-
'no-prototype-builtins': 1,
|
|
151
|
-
'no-redeclare': 'off',
|
|
152
|
-
'no-trailing-spaces': 2,
|
|
153
|
-
'no-var': 2,
|
|
154
|
-
'no-whitespace-before-property': 2,
|
|
155
|
-
'object-shorthand': 2,
|
|
156
|
-
'quotes': [
|
|
157
|
-
2,
|
|
158
|
-
'single',
|
|
159
|
-
{
|
|
160
|
-
avoidEscape: true,
|
|
161
|
-
allowTemplateLiterals: true,
|
|
162
|
-
},
|
|
163
|
-
],
|
|
164
|
-
'radix': [2, 'always'],
|
|
165
|
-
'require-atomic-updates': 0,
|
|
128
|
+
'promise/catch-or-return': 'warn',
|
|
129
|
+
'promise/no-return-wrap': 'warn',
|
|
130
|
+
'promise/prefer-await-to-callbacks': 'warn',
|
|
131
|
+
'promise/prefer-await-to-then': 'warn',
|
|
132
|
+
'promise/param-names': 'warn',
|
|
133
|
+
|
|
134
|
+
'arrow-body-style': 'warn',
|
|
135
|
+
'curly': 'error',
|
|
136
|
+
'dot-notation': 'error',
|
|
137
|
+
'eqeqeq': ['error', 'smart'],
|
|
138
|
+
'no-console': 'error',
|
|
139
|
+
'no-empty': 'off',
|
|
140
|
+
'no-prototype-builtins': 'warn',
|
|
141
|
+
'object-shorthand': 'error',
|
|
142
|
+
'radix': 'error',
|
|
143
|
+
'require-atomic-updates': 'off',
|
|
166
144
|
/**
|
|
167
145
|
* Allow `async` functions without `await`.
|
|
168
146
|
* @remarks Originally, this was to be more clear about the return value of a function, but with
|
|
@@ -170,26 +148,18 @@ export default [
|
|
|
170
148
|
* `return await somePromise` have their own use-cases.
|
|
171
149
|
*/
|
|
172
150
|
'require-await': 'off',
|
|
173
|
-
'
|
|
174
|
-
'space-before-blocks': [2, 'always'],
|
|
175
|
-
'space-in-parens': [2, 'never'],
|
|
176
|
-
'space-infix-ops': 2,
|
|
177
|
-
'space-unary-ops': [
|
|
178
|
-
2,
|
|
179
|
-
{
|
|
180
|
-
words: true,
|
|
181
|
-
nonwords: false,
|
|
182
|
-
},
|
|
183
|
-
],
|
|
151
|
+
'unicorn/prefer-node-protocol': 'warn'
|
|
184
152
|
}
|
|
185
153
|
},
|
|
186
154
|
|
|
187
155
|
{
|
|
188
|
-
...mochaPlugin.configs.recommended,
|
|
189
156
|
name: 'Test Files',
|
|
190
157
|
files: ['**/test/**', '*.spec.*js', '-specs.*js', '*.spec.ts'],
|
|
158
|
+
plugins: {
|
|
159
|
+
mocha: mochaPlugin,
|
|
160
|
+
},
|
|
161
|
+
extends: [mochaPlugin.configs.recommended],
|
|
191
162
|
rules: {
|
|
192
|
-
...mochaPlugin.configs.recommended.rules,
|
|
193
163
|
/**
|
|
194
164
|
* Both `@ts-expect-error` and `@ts-ignore` are allowed to be used with impunity in tests.
|
|
195
165
|
* @remarks We often test things which explicitly violate types.
|
|
@@ -202,27 +172,21 @@ export default [
|
|
|
202
172
|
*/
|
|
203
173
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
204
174
|
'@typescript-eslint/no-unused-expressions': 'off',
|
|
205
|
-
'import/no-named-as-default-member': 'off',
|
|
175
|
+
'import-x/no-named-as-default-member': 'off',
|
|
206
176
|
'mocha/consistent-spacing-between-blocks': 'off',
|
|
207
177
|
'mocha/max-top-level-suites': 'off',
|
|
208
|
-
'mocha/no-exclusive-tests':
|
|
178
|
+
'mocha/no-exclusive-tests': 'error',
|
|
209
179
|
'mocha/no-exports': 'off',
|
|
210
|
-
'mocha/no-mocha-arrows': 2,
|
|
211
180
|
'mocha/no-pending-tests': 'off',
|
|
212
181
|
'mocha/no-setup-in-describe': 'off',
|
|
213
182
|
},
|
|
214
183
|
},
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
'**/coverage/**',
|
|
225
|
-
],
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
];
|
|
184
|
+
fs.existsSync(gitignorePath) ? includeIgnoreFile(gitignorePath) : {},
|
|
185
|
+
globalIgnores([
|
|
186
|
+
'**/.*',
|
|
187
|
+
'**/*-d.ts',
|
|
188
|
+
'**/*.min.js',
|
|
189
|
+
'**/build/**',
|
|
190
|
+
'**/coverage/**',
|
|
191
|
+
]),
|
|
192
|
+
]);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appium/eslint-config-appium-ts",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.0.1",
|
|
5
5
|
"description": "Shared ESLint config for Appium projects (TypeScript version)",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"eslint",
|
|
@@ -29,14 +29,17 @@
|
|
|
29
29
|
"test:smoke": "exit 0"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@eslint/compat": "2.0.
|
|
33
|
-
"@eslint/js": "9.39.
|
|
32
|
+
"@eslint/compat": "2.0.3",
|
|
33
|
+
"@eslint/js": "9.39.4",
|
|
34
|
+
"@stylistic/eslint-plugin": "5.10.0",
|
|
34
35
|
"eslint-config-prettier": "10.1.8",
|
|
35
36
|
"eslint-import-resolver-typescript": "4.4.4",
|
|
36
|
-
"eslint-plugin-import": "
|
|
37
|
+
"eslint-plugin-import-x": "4.16.1",
|
|
37
38
|
"eslint-plugin-mocha": "11.2.0",
|
|
39
|
+
"eslint-plugin-n": "17.24.0",
|
|
38
40
|
"eslint-plugin-promise": "7.2.1",
|
|
39
|
-
"
|
|
41
|
+
"eslint-plugin-unicorn": "63.0.0",
|
|
42
|
+
"typescript-eslint": "8.56.1"
|
|
40
43
|
},
|
|
41
44
|
"peerDependencies": {
|
|
42
45
|
"eslint": "^9.0.0"
|
|
@@ -48,5 +51,5 @@
|
|
|
48
51
|
"publishConfig": {
|
|
49
52
|
"access": "public"
|
|
50
53
|
},
|
|
51
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "980a121804ae006db879fb6860f627ac36174c15"
|
|
52
55
|
}
|