@travetto/eslint 7.0.0-rc.4 → 7.0.0
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
CHANGED
|
@@ -24,7 +24,7 @@ In a new project, the first thing that will need to be done, post installation,
|
|
|
24
24
|
```bash
|
|
25
25
|
$ trv eslint:register
|
|
26
26
|
|
|
27
|
-
Wrote eslint config to <workspace-root>/eslint.config.
|
|
27
|
+
Wrote eslint config to <workspace-root>/eslint.config.js
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
This is the file the linter will use, and any other tooling (e.g. IDEs).
|
|
@@ -33,17 +33,17 @@ This is the file the linter will use, and any other tooling (e.g. IDEs).
|
|
|
33
33
|
```javascript
|
|
34
34
|
process.env.TRV_MANIFEST = './.trv/output/node_modules/@travetto/mono-repo';
|
|
35
35
|
|
|
36
|
-
const { buildConfig } =
|
|
37
|
-
const { RuntimeIndex } =
|
|
36
|
+
const { buildConfig } = await import('./.trv/output/node_modules/@travetto/eslint/support/bin/eslint-config.js');
|
|
37
|
+
const { RuntimeIndex } = await import('./.trv/output/node_modules/@travetto/runtime/__index__.js');
|
|
38
38
|
|
|
39
39
|
const pluginFiles = RuntimeIndex.find({
|
|
40
40
|
folder: folder => folder === 'support',
|
|
41
41
|
file: file => /support\/eslint[.]/.test(file.relativeFile)
|
|
42
42
|
});
|
|
43
|
-
const plugins = pluginFiles.map(plugin =>
|
|
43
|
+
const plugins = await Promise.all(pluginFiles.map(plugin => import(plugin.outputFile)))
|
|
44
44
|
const config = buildConfig(plugins);
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
export default config;
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
The output is tied to whether or not you are using the [CommonJS](https://nodejs.org/api/modules.html) or [Ecmascript Module](https://nodejs.org/api/esm.html) format.
|
|
@@ -131,15 +131,6 @@ export const ImportOrder: TrvEslintPlugin = {
|
|
|
131
131
|
} else if (initType === 'TSAsExpression') { // tslint support
|
|
132
132
|
call = declaration.init.expression;
|
|
133
133
|
}
|
|
134
|
-
if (
|
|
135
|
-
call?.type === 'CallExpression' && call.callee.type === 'Identifier' &&
|
|
136
|
-
call.callee.name === 'require' && call.arguments[0].type === 'Literal'
|
|
137
|
-
) {
|
|
138
|
-
const arg1 = call.arguments[0];
|
|
139
|
-
if (arg1.value && typeof arg1.value === 'string') {
|
|
140
|
-
from = arg1.value;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
134
|
}
|
|
144
135
|
|
|
145
136
|
if (!from) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/eslint",
|
|
3
|
-
"version": "7.0.0
|
|
3
|
+
"version": "7.0.0",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"description": "ES Linting Rules",
|
|
5
6
|
"keywords": [
|
|
6
7
|
"eslint",
|
|
@@ -24,17 +25,17 @@
|
|
|
24
25
|
"directory": "module/eslint"
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"@eslint/js": "^9.
|
|
28
|
+
"@eslint/js": "^9.39.2",
|
|
28
29
|
"@stylistic/eslint-plugin": "^5.6.1",
|
|
29
|
-
"@travetto/runtime": "^7.0.0
|
|
30
|
+
"@travetto/runtime": "^7.0.0",
|
|
30
31
|
"@types/eslint": "^9.6.1",
|
|
31
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
32
|
-
"@typescript-eslint/parser": "^8.
|
|
33
|
-
"eslint": "^9.39.
|
|
32
|
+
"@typescript-eslint/eslint-plugin": "^8.50.1",
|
|
33
|
+
"@typescript-eslint/parser": "^8.50.1",
|
|
34
|
+
"eslint": "^9.39.2",
|
|
34
35
|
"eslint-plugin-unused-imports": "^4.3.0"
|
|
35
36
|
},
|
|
36
37
|
"peerDependencies": {
|
|
37
|
-
"@travetto/cli": "^7.0.0
|
|
38
|
+
"@travetto/cli": "^7.0.0"
|
|
38
39
|
},
|
|
39
40
|
"peerDependenciesMeta": {
|
|
40
41
|
"@travetto/cli": {
|
|
@@ -5,8 +5,7 @@ import { Runtime, RuntimeIndex } from '@travetto/runtime';
|
|
|
5
5
|
|
|
6
6
|
export async function buildEslintConfig(): Promise<string> {
|
|
7
7
|
const root = RuntimeIndex.getModule('@travetto/eslint')!.sourcePath;
|
|
8
|
-
const
|
|
9
|
-
const tpl = await fs.readFile(path.resolve(root, 'resources', `eslint-config-file${ext}`), 'utf8');
|
|
8
|
+
const tpl = await fs.readFile(path.resolve(root, 'resources', 'eslint-config-file.js'), 'utf8');
|
|
10
9
|
|
|
11
10
|
// Get path to repo-root output
|
|
12
11
|
const outputPath = path.join(
|
|
@@ -13,8 +13,7 @@ export class ESLintConfigureCommand implements CliCommandShape {
|
|
|
13
13
|
|
|
14
14
|
async main(): Promise<void> {
|
|
15
15
|
const content = await buildEslintConfig();
|
|
16
|
-
const
|
|
17
|
-
const output = Runtime.workspaceRelative(`eslint.config${ext}`);
|
|
16
|
+
const output = Runtime.workspaceRelative('eslint.config.js');
|
|
18
17
|
await fs.writeFile(output, content.replaceAll(Runtime.workspace.path, '.').trim());
|
|
19
18
|
console.log(`Wrote eslint config to ${output}`);
|
|
20
19
|
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
process.env.TRV_MANIFEST = '%MANIFEST_FILE%';
|
|
2
|
-
|
|
3
|
-
const { buildConfig } = require('@travetto/eslint/support/bin/eslint-config');
|
|
4
|
-
const { RuntimeIndex } = require('@travetto/runtime/__index__');
|
|
5
|
-
|
|
6
|
-
const pluginFiles = RuntimeIndex.find({
|
|
7
|
-
folder: folder => folder === 'support',
|
|
8
|
-
file: file => /support\/eslint[.]/.test(file.relativeFile)
|
|
9
|
-
});
|
|
10
|
-
const plugins = pluginFiles.map(plugin => require(plugin.outputFile));
|
|
11
|
-
const config = buildConfig(plugins);
|
|
12
|
-
|
|
13
|
-
module.exports = config;
|
|
File without changes
|