@companion-module/tools 1.5.1 → 2.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/CHANGELOG.md +18 -0
- package/README.md +61 -4
- package/eslint/config.mjs +139 -0
- package/package.json +37 -16
- package/scripts/build.js +3 -1
- package/eslint/fragments.cjs +0 -62
- package/eslint/index.cjs +0 -96
- package/eslint/main.cjs +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.0.1](https://github.com/bitfocus/companion-module-tools/compare/v2.0.0...v2.0.1) (2024-09-08)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* avoid `yarn` calls inside build script ([d8086c0](https://github.com/bitfocus/companion-module-tools/commit/d8086c0dda9907a387a3eb57690077f0af4459da))
|
|
9
|
+
|
|
10
|
+
## [2.0.0](https://github.com/bitfocus/companion-module-tools/compare/v1.5.1...v2.0.0) (2024-08-25)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### ⚠ BREAKING CHANGES
|
|
14
|
+
|
|
15
|
+
* remove eslint and prettier as dependencies, modules should install these directly ([#43](https://github.com/bitfocus/companion-module-tools/issues/43))
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* remove eslint and prettier as dependencies, modules should install these directly ([#43](https://github.com/bitfocus/companion-module-tools/issues/43)) ([45615fc](https://github.com/bitfocus/companion-module-tools/commit/45615fc3d5448d32ea37b9023e9476ca4893c407))
|
|
20
|
+
|
|
3
21
|
## [1.5.1](https://github.com/bitfocus/companion-module-tools/compare/v1.5.0...v1.5.1) (2024-06-20)
|
|
4
22
|
|
|
5
23
|
|
package/README.md
CHANGED
|
@@ -1,15 +1,72 @@
|
|
|
1
1
|
# @companion-module/tools
|
|
2
2
|
|
|
3
|
-
This is a collection of tools
|
|
3
|
+
This is a collection of tools used for developing and verifying Companion modules.
|
|
4
4
|
|
|
5
5
|
## Scripts
|
|
6
6
|
|
|
7
7
|
### companion-module-build
|
|
8
8
|
|
|
9
|
-
When used, this will build a module ready for
|
|
9
|
+
When used, this will build a module ready for distribution.
|
|
10
10
|
|
|
11
|
-
More information on this command is available [on the wiki](https://github.com/bitfocus/companion-module-base/wiki/Module-packaging)
|
|
11
|
+
More information on this command is available [on the wiki](https://github.com/bitfocus/companion-module-base/wiki/Module-packaging).
|
|
12
12
|
|
|
13
13
|
### companion-generate-manifest
|
|
14
14
|
|
|
15
|
-
Generate the new format manifest from an old package.json
|
|
15
|
+
Generate the new format manifest from an old `package.json`.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## Upgrading from v1.x to v2.0
|
|
19
|
+
|
|
20
|
+
v2.0 of this library includes some breaking changes to how eslint and prettier handled. Instead of it being installed as a dependency and being directly usable by modules, it has to be explicitly installed by modules.
|
|
21
|
+
|
|
22
|
+
This change was done for two reasons:
|
|
23
|
+
|
|
24
|
+
1) Very few modules use eslint, making this extra weight for them for no gain.
|
|
25
|
+
2) Recent versions of yarn do not expose these binaries in a way which is easily callable by modules, requiring tricks to be able to execute them.
|
|
26
|
+
|
|
27
|
+
To resolve this, you will need to do a `yarn add --dev eslint prettier` in your modules to install the dependencies, and update any scripts to remove the invocation hacks.
|
|
28
|
+
|
|
29
|
+
This also allows for eslint to be updated to v9, which requires a new config format. This unfortunately means that your config file needs to be replaced.
|
|
30
|
+
|
|
31
|
+
A new basic config should be called `eslint.config.mjs` (remove any existing `.eslintrc.json` or `.eslintrc.cjs`) and could contain:
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
import { generateEslintConfig } from '@companion-module/tools/eslint/config.mjs'
|
|
35
|
+
|
|
36
|
+
export default generateEslintConfig({})
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
If using TypeScript, you should specify a `typescriptRoot`:
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
import { generateEslintConfig } from '@companion-module/tools/eslint/config.mjs'
|
|
43
|
+
|
|
44
|
+
export default generateEslintConfig({
|
|
45
|
+
enableTypescript: true,
|
|
46
|
+
})
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
You can easily override rules in this setup with:
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
import { generateEslintConfig } from '@companion-module/tools/eslint/config.mjs'
|
|
53
|
+
|
|
54
|
+
const baseConfig = await generateEslintConfig({
|
|
55
|
+
enableTypescript: true,
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
const customConfig = [
|
|
59
|
+
...baseConfig,
|
|
60
|
+
|
|
61
|
+
{
|
|
62
|
+
rules: {
|
|
63
|
+
'n/no-missing-import': 'off',
|
|
64
|
+
'node/no-unpublished-import': 'off',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
export default customConfig
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
More options are available for the `generateEslintConfig` function, check the wiki or the method signature to see what is available.
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
|
|
4
|
+
import eslint from '@eslint/js'
|
|
5
|
+
import neslint from 'eslint-plugin-n'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @template T
|
|
10
|
+
* @param {Record<string, T | null | undefined>} obj
|
|
11
|
+
* @returns {Record<string, T>}
|
|
12
|
+
*/
|
|
13
|
+
function compactObj(obj) {
|
|
14
|
+
/** @type {Record<string, T>} */
|
|
15
|
+
const result = {}
|
|
16
|
+
|
|
17
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
18
|
+
if (value) result[key] = value
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return result
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/***
|
|
25
|
+
* @param {{ enableJest?: boolean, enableTypescript?: boolean, ignores?: string[] }} [options={}] - Options to customize the config
|
|
26
|
+
* @returns {Promise<import('eslint').Linter.Config[]>}
|
|
27
|
+
*/
|
|
28
|
+
export async function generateEslintConfig(options = {}) {
|
|
29
|
+
const tseslint = options.enableTypescript ? await import('typescript-eslint') : null
|
|
30
|
+
|
|
31
|
+
/** @type {import('eslint').Linter.Config} */
|
|
32
|
+
const result = {
|
|
33
|
+
// extends: commonExtends,
|
|
34
|
+
plugins: compactObj({
|
|
35
|
+
'@typescript-eslint': tseslint ? tseslint.plugin : null,
|
|
36
|
+
}),
|
|
37
|
+
rules: {
|
|
38
|
+
// Default rules to be applied everywhere
|
|
39
|
+
'prettier/prettier': 'error',
|
|
40
|
+
|
|
41
|
+
...eslint.configs.recommended.rules,
|
|
42
|
+
|
|
43
|
+
'no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_(.+)' }],
|
|
44
|
+
'no-extra-semi': 'off',
|
|
45
|
+
// 'n/no-unsupported-features/es-syntax': ['error', { ignores: ['modules'] }],
|
|
46
|
+
'no-use-before-define': 'off',
|
|
47
|
+
'no-warning-comments': ['error', { terms: ['nocommit', '@nocommit', '@no-commit'] }],
|
|
48
|
+
// 'jest/no-mocks-import': 'off',
|
|
49
|
+
},
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return [
|
|
53
|
+
// setup the parser first
|
|
54
|
+
tseslint
|
|
55
|
+
? {
|
|
56
|
+
languageOptions: {
|
|
57
|
+
parser: tseslint.parser,
|
|
58
|
+
parserOptions: {
|
|
59
|
+
project: true,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
}
|
|
63
|
+
: null,
|
|
64
|
+
|
|
65
|
+
neslint.configs['flat/recommended-script'],
|
|
66
|
+
result,
|
|
67
|
+
...(tseslint ? tseslint.configs.recommendedTypeChecked : []),
|
|
68
|
+
{
|
|
69
|
+
// disable type-aware linting on JS files
|
|
70
|
+
files: ['**/*.js', '**/*.cjs', '**/*.mjs'],
|
|
71
|
+
...(tseslint ? tseslint.configs.disableTypeChecked : {}),
|
|
72
|
+
},
|
|
73
|
+
tseslint
|
|
74
|
+
? {
|
|
75
|
+
files: ['**/*.ts', '**/*.cts', '**/*.mts'],
|
|
76
|
+
rules: {
|
|
77
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
78
|
+
'@typescript-eslint/interface-name-prefix': 'off',
|
|
79
|
+
'@typescript-eslint/no-unused-vars': [
|
|
80
|
+
'error',
|
|
81
|
+
{ argsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_', varsIgnorePattern: '^_(.+)' },
|
|
82
|
+
],
|
|
83
|
+
'@typescript-eslint/no-floating-promises': 'error',
|
|
84
|
+
'@typescript-eslint/explicit-module-boundary-types': ['error'],
|
|
85
|
+
'@typescript-eslint/promise-function-async': 'error',
|
|
86
|
+
'@typescript-eslint/require-await': 'off', // conflicts with 'promise-function-async'
|
|
87
|
+
|
|
88
|
+
/** Disable some annoyingly strict rules from the 'recommended-requiring-type-checking' pack */
|
|
89
|
+
'@typescript-eslint/no-unsafe-assignment': 0,
|
|
90
|
+
'@typescript-eslint/no-unsafe-member-access': 0,
|
|
91
|
+
'@typescript-eslint/no-unsafe-argument': 0,
|
|
92
|
+
'@typescript-eslint/no-unsafe-return': 0,
|
|
93
|
+
'@typescript-eslint/no-unsafe-call': 0,
|
|
94
|
+
'@typescript-eslint/restrict-template-expressions': 0,
|
|
95
|
+
'@typescript-eslint/restrict-plus-operands': 0,
|
|
96
|
+
'@typescript-eslint/no-redundant-type-constituents': 0,
|
|
97
|
+
/** End 'recommended-requiring-type-checking' overrides */
|
|
98
|
+
},
|
|
99
|
+
}
|
|
100
|
+
: null,
|
|
101
|
+
tseslint
|
|
102
|
+
? {
|
|
103
|
+
files: ['**/__tests__/**/*', 'test/**/*'],
|
|
104
|
+
rules: {
|
|
105
|
+
'@typescript-eslint/ban-ts-ignore': 'off',
|
|
106
|
+
'@typescript-eslint/ban-ts-comment': 'off',
|
|
107
|
+
},
|
|
108
|
+
}
|
|
109
|
+
: null,
|
|
110
|
+
{
|
|
111
|
+
// disable type-aware linting on JS files
|
|
112
|
+
files: [
|
|
113
|
+
'examples/**/*.js',
|
|
114
|
+
'examples/**/*.cjs',
|
|
115
|
+
'examples/**/*.mjs',
|
|
116
|
+
'examples/**/*.ts',
|
|
117
|
+
'examples/**/*.cts',
|
|
118
|
+
'examples/**/*.mts',
|
|
119
|
+
],
|
|
120
|
+
rules: {
|
|
121
|
+
'no-process-exit': 'off',
|
|
122
|
+
'n/no-missing-import': 'off',
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
// Add prettier at the end to give it final say on formatting
|
|
127
|
+
eslintPluginPrettierRecommended,
|
|
128
|
+
{
|
|
129
|
+
// But lastly, ensure that we ignore certain paths
|
|
130
|
+
ignores: ['**/dist/*', '/dist', '**/pkg/*', '**/docs/*', '**/generated/*', ...(options.ignores || [])],
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
files: ['eslint.config.*'],
|
|
134
|
+
rules: {
|
|
135
|
+
'n/no-unpublished-import': 'off',
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
].filter((v) => !!v)
|
|
139
|
+
}
|
package/package.json
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@companion-module/tools",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"repository":
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/bitfocus/companion-module-tools.git"
|
|
10
|
+
},
|
|
8
11
|
"bin": {
|
|
12
|
+
"companion-generate-manifest": "scripts/generate-manifest.js",
|
|
9
13
|
"companion-module-build": "scripts/build.js",
|
|
10
|
-
"companion-module-check": "scripts/check.js"
|
|
11
|
-
"companion-generate-manifest": "scripts/generate-manifest.js"
|
|
14
|
+
"companion-module-check": "scripts/check.js"
|
|
12
15
|
},
|
|
13
16
|
"engines": {
|
|
14
|
-
"node": "^18.
|
|
17
|
+
"node": "^18.18"
|
|
15
18
|
},
|
|
16
19
|
"files": [
|
|
17
20
|
"eslint",
|
|
@@ -23,21 +26,39 @@
|
|
|
23
26
|
"webpack.*"
|
|
24
27
|
],
|
|
25
28
|
"dependencies": {
|
|
26
|
-
"@
|
|
27
|
-
"
|
|
28
|
-
"eslint": "^
|
|
29
|
-
"eslint-
|
|
30
|
-
"eslint-plugin-n": "^16.6.2",
|
|
31
|
-
"eslint-plugin-prettier": "^4.2.1",
|
|
29
|
+
"@eslint/js": "^9.9.1",
|
|
30
|
+
"eslint-config-prettier": "^9.1.0",
|
|
31
|
+
"eslint-plugin-n": "^17.10.2",
|
|
32
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
32
33
|
"find-up": "^7.0.0",
|
|
33
34
|
"parse-author": "^2.0.0",
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"webpack": "^5.90.0",
|
|
35
|
+
"tar": "^7.4.3",
|
|
36
|
+
"webpack": "^5.94.0",
|
|
37
37
|
"webpack-cli": "^5.1.4",
|
|
38
38
|
"zx": "^7.2.3"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@companion-module/base": "^1.
|
|
42
|
-
|
|
41
|
+
"@companion-module/base": "^1.7.1",
|
|
42
|
+
"eslint": "^9.0.0",
|
|
43
|
+
"prettier": "^3.0.0",
|
|
44
|
+
"typescript-eslint": "^8.2.0"
|
|
45
|
+
},
|
|
46
|
+
"peerDependenciesMeta": {
|
|
47
|
+
"eslint": {
|
|
48
|
+
"optional": true
|
|
49
|
+
},
|
|
50
|
+
"prettier": {
|
|
51
|
+
"optional": true
|
|
52
|
+
},
|
|
53
|
+
"typescript-eslint": {
|
|
54
|
+
"optional": true
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@types/eslint": "^9.6.0",
|
|
59
|
+
"eslint": "^9.9.1",
|
|
60
|
+
"prettier": "^3.3.3",
|
|
61
|
+
"typescript-eslint": "^8.2.0"
|
|
62
|
+
},
|
|
63
|
+
"packageManager": "yarn@4.4.1"
|
|
43
64
|
}
|
package/scripts/build.js
CHANGED
|
@@ -44,7 +44,9 @@ for (const [k, v] of Object.entries(webpackArgs)) {
|
|
|
44
44
|
// build the code
|
|
45
45
|
$.cwd = toolsDir
|
|
46
46
|
const webpackConfig = path.join(toolsDir, 'webpack.config.cjs').replace(/\\/g, '/') // Fix slashes because windows is a pain
|
|
47
|
-
|
|
47
|
+
const webpackPath = path.join(toolsDir, 'node_modules', '.bin', 'webpack').replace(/\\/g, '/') // Fix slashes because windows is a pain
|
|
48
|
+
// Use a manual path to the webpack binary to avoid issues with yarn versions
|
|
49
|
+
await $`${webpackPath} -c ${webpackConfig} ${webpackArgsArray}`
|
|
48
50
|
$.cwd = undefined
|
|
49
51
|
|
|
50
52
|
// copy in the metadata
|
package/eslint/fragments.cjs
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
function compact(arr) {
|
|
2
|
-
return arr.filter((v) => v !== undefined && v !== null)
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
module.exports = function createFragments(enableJest) {
|
|
6
|
-
return {
|
|
7
|
-
commonPlugins: compact(['prettier', enableJest ? 'jest' : null]),
|
|
8
|
-
tsPlugins: compact(['@typescript-eslint', 'prettier', enableJest ? 'jest' : null]),
|
|
9
|
-
|
|
10
|
-
commonExtends: ['eslint:recommended', 'plugin:n/recommended', 'plugin:prettier/recommended'],
|
|
11
|
-
tsExtends: compact([
|
|
12
|
-
'eslint:recommended',
|
|
13
|
-
'plugin:@typescript-eslint/eslint-recommended',
|
|
14
|
-
'plugin:@typescript-eslint/recommended',
|
|
15
|
-
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
|
16
|
-
'plugin:n/recommended',
|
|
17
|
-
enableJest ? 'plugin:jest/recommended' : null,
|
|
18
|
-
'prettier',
|
|
19
|
-
'plugin:prettier/recommended',
|
|
20
|
-
]),
|
|
21
|
-
|
|
22
|
-
commonRules: {
|
|
23
|
-
'prettier/prettier': 'error',
|
|
24
|
-
'no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_(.+)' }],
|
|
25
|
-
'no-extra-semi': 'off',
|
|
26
|
-
'n/no-unsupported-features/es-syntax': ['error', { ignores: ['modules'] }],
|
|
27
|
-
'no-use-before-define': 'off',
|
|
28
|
-
'no-warning-comments': ['error', { terms: ['nocommit', '@nocommit', '@no-commit'] }],
|
|
29
|
-
'jest/no-mocks-import': 'off',
|
|
30
|
-
},
|
|
31
|
-
tsRules: {
|
|
32
|
-
'no-unused-vars': 'off',
|
|
33
|
-
'@typescript-eslint/no-explicit-any': 'off',
|
|
34
|
-
'@typescript-eslint/interface-name-prefix': 'off',
|
|
35
|
-
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_(.+)' }],
|
|
36
|
-
'@typescript-eslint/no-floating-promises': 'error',
|
|
37
|
-
'@typescript-eslint/explicit-module-boundary-types': ['error'],
|
|
38
|
-
'@typescript-eslint/promise-function-async': 'error',
|
|
39
|
-
'@typescript-eslint/require-await': 'off', // conflicts with 'promise-function-async'
|
|
40
|
-
|
|
41
|
-
/** Disable some annoyingly strict rules from the 'recommended-requiring-type-checking' pack */
|
|
42
|
-
'@typescript-eslint/no-unsafe-assignment': 0,
|
|
43
|
-
'@typescript-eslint/no-unsafe-member-access': 0,
|
|
44
|
-
'@typescript-eslint/no-unsafe-argument': 0,
|
|
45
|
-
'@typescript-eslint/no-unsafe-return': 0,
|
|
46
|
-
'@typescript-eslint/no-unsafe-call': 0,
|
|
47
|
-
'@typescript-eslint/restrict-template-expressions': 0,
|
|
48
|
-
'@typescript-eslint/restrict-plus-operands': 0,
|
|
49
|
-
/** End 'recommended-requiring-type-checking' overrides */
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
tsParser: {
|
|
53
|
-
parser: '@typescript-eslint/parser',
|
|
54
|
-
parserOptions: { project: './tsconfig.json' },
|
|
55
|
-
settings: {
|
|
56
|
-
node: {
|
|
57
|
-
tryExtensions: ['.js', '.json', '.node', '.ts', '.d.ts'],
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
}
|
|
62
|
-
}
|
package/eslint/index.cjs
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
const createFragments = require('./fragments.cjs')
|
|
2
|
-
|
|
3
|
-
module.exports = function generateEslintConfig(options = {}) {
|
|
4
|
-
const { commonPlugins, tsPlugins, commonExtends, tsExtends, commonRules, tsRules, tsParser } = createFragments(
|
|
5
|
-
options.enableJest
|
|
6
|
-
)
|
|
7
|
-
|
|
8
|
-
const disableJest = options.enableJest
|
|
9
|
-
? {
|
|
10
|
-
'jest/globals': false, // Block jest from this
|
|
11
|
-
}
|
|
12
|
-
: {}
|
|
13
|
-
const allowJest = options.enableJest
|
|
14
|
-
? {
|
|
15
|
-
'jest/globals': true,
|
|
16
|
-
jest: true,
|
|
17
|
-
}
|
|
18
|
-
: {}
|
|
19
|
-
|
|
20
|
-
const result = {
|
|
21
|
-
extends: commonExtends,
|
|
22
|
-
plugins: commonPlugins,
|
|
23
|
-
rules: {
|
|
24
|
-
'prettier/prettier': 'error',
|
|
25
|
-
},
|
|
26
|
-
env: { es2017: true },
|
|
27
|
-
parserOptions: { sourceType: 'module', ecmaVersion: 2022 },
|
|
28
|
-
overrides: [
|
|
29
|
-
// Note: the overrides replace the values defined above, so make sure to extend them if they are needed
|
|
30
|
-
{
|
|
31
|
-
files: ['*.js', '*.cjs', '*.mjs'],
|
|
32
|
-
settings: {
|
|
33
|
-
node: {
|
|
34
|
-
tryExtensions: ['.js', '.json', '.node', '.ts'],
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
env: {
|
|
38
|
-
...disableJest,
|
|
39
|
-
},
|
|
40
|
-
rules: {
|
|
41
|
-
...commonRules,
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (options.enableTypescript) {
|
|
48
|
-
result.overrides.push(
|
|
49
|
-
{
|
|
50
|
-
files: ['*.ts'],
|
|
51
|
-
extends: tsExtends,
|
|
52
|
-
plugins: tsPlugins,
|
|
53
|
-
...tsParser,
|
|
54
|
-
env: {
|
|
55
|
-
...disableJest,
|
|
56
|
-
},
|
|
57
|
-
rules: {
|
|
58
|
-
...commonRules,
|
|
59
|
-
...tsRules,
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
files: ['src/**/__tests__/**/*.ts'],
|
|
64
|
-
extends: tsExtends,
|
|
65
|
-
plugins: tsPlugins,
|
|
66
|
-
...tsParser,
|
|
67
|
-
env: {
|
|
68
|
-
...allowJest,
|
|
69
|
-
},
|
|
70
|
-
rules: {
|
|
71
|
-
...commonRules,
|
|
72
|
-
...tsRules,
|
|
73
|
-
'@typescript-eslint/ban-ts-ignore': 'off',
|
|
74
|
-
'@typescript-eslint/ban-ts-comment': 'off',
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
files: ['examples/**/*.ts'],
|
|
79
|
-
extends: tsExtends,
|
|
80
|
-
plugins: tsPlugins,
|
|
81
|
-
...tsParser,
|
|
82
|
-
env: {
|
|
83
|
-
...disableJest,
|
|
84
|
-
},
|
|
85
|
-
rules: {
|
|
86
|
-
...commonRules,
|
|
87
|
-
...tsRules,
|
|
88
|
-
'no-process-exit': 'off',
|
|
89
|
-
'n/no-missing-import': 'off',
|
|
90
|
-
},
|
|
91
|
-
}
|
|
92
|
-
)
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return result
|
|
96
|
-
}
|