weboptimizer 2.0.1467 → 2.0.1468
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/eslint.config.mjs +11 -5
- package/package.json +1 -1
- package/tsconfig.json +1 -0
package/eslint.config.mjs
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import clientnode from 'clientnode';
|
|
2
2
|
import google from 'eslint-config-google';
|
|
3
3
|
import jsdoc from 'eslint-plugin-jsdoc';
|
|
4
|
+
import { readFile } from 'fs/promises';
|
|
4
5
|
import globals from 'globals';
|
|
5
|
-
import
|
|
6
|
+
import { resolve } from 'path';
|
|
7
|
+
import { cwd } from 'process';
|
|
6
8
|
import typescript from 'typescript-eslint';
|
|
9
|
+
import js from '@eslint/js';
|
|
7
10
|
import typescriptPlugin from '@typescript-eslint/eslint-plugin';
|
|
8
11
|
import typescriptParser from '@typescript-eslint/parser';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
+
const Tools = clientnode.Tools;
|
|
12
15
|
|
|
13
16
|
// Remove unsupported rules.
|
|
14
17
|
const unsuportedRules = ['require-jsdoc', 'valid-jsdoc'];
|
|
@@ -16,8 +19,11 @@ const googleRules = Object.keys(google.rules).filter(key => !unsuportedRules.inc
|
|
|
16
19
|
...object,
|
|
17
20
|
[key]: google.rules[key]
|
|
18
21
|
}), {});
|
|
22
|
+
const isLibrary = JSON.parse(await readFile(resolve(cwd(), './package.json'), {
|
|
23
|
+
encoding: 'utf-8'
|
|
24
|
+
})).default?.webOptimizer?.library ?? false;
|
|
19
25
|
let tsConfigFilePath = '';
|
|
20
|
-
for (const filePath of ['./tsconfig.json', './node_modules/weboptimizer/tsconfig.json
|
|
26
|
+
for (const filePath of ['./tsconfig.json', './node_modules/weboptimizer/tsconfig.' + `${isLibrary ? 'library' : 'application'}.json`]) if (await Tools.isFile(filePath)) {
|
|
21
27
|
tsConfigFilePath = filePath;
|
|
22
28
|
break;
|
|
23
29
|
}
|
package/package.json
CHANGED