@nx/oxlint 23.2.0-pr.36866.449f6f3 → 23.2.0-rc.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/dist/src/plugins/plugin.js +34 -12
- package/package.json +5 -5
|
@@ -27,6 +27,10 @@ const LINTABLE_EXTENSIONS = [
|
|
|
27
27
|
'astro',
|
|
28
28
|
];
|
|
29
29
|
const LINTABLE_FILES_GLOB = `**/*.{${LINTABLE_EXTENSIONS.join(',')}}`;
|
|
30
|
+
// Oxlint honours both, so both decide which files it lints.
|
|
31
|
+
const IGNORE_FILENAMES = ['.eslintignore', '.gitignore'];
|
|
32
|
+
// The one rule that looks across projects; every other rule sees one file.
|
|
33
|
+
const BOUNDARIES_PLUGIN_SPECIFIER = '@nx/oxlint/boundaries-plugin';
|
|
30
34
|
const PROJECT_CONFIG_FILENAMES = ['project.json', 'package.json'];
|
|
31
35
|
const OXLINT_CONFIG_GLOB = combineGlobPatterns([
|
|
32
36
|
...OXLINT_CONFIG_FILENAMES.map((f) => `**/${f}`),
|
|
@@ -116,7 +120,7 @@ export const createNodes = [
|
|
|
116
120
|
...allConfigs.flatMap((config) => localJsPluginFiles(config, jsPluginSpecifiersByConfig.get(config) ?? [])),
|
|
117
121
|
// Change which files Oxlint considers lintable, and therefore
|
|
118
122
|
// whether a target is inferred at all.
|
|
119
|
-
...
|
|
123
|
+
...ancestorIgnorePaths(root),
|
|
120
124
|
lockFilePattern,
|
|
121
125
|
...(tsconfigChainsByProjectRoot.get(root) ?? []),
|
|
122
126
|
]),
|
|
@@ -516,16 +520,18 @@ async function collectLintableFilesByProjectRoot(projectRoots, context) {
|
|
|
516
520
|
return lintableFilesPerProjectRoot;
|
|
517
521
|
}
|
|
518
522
|
/**
|
|
519
|
-
*
|
|
523
|
+
* Ignore-file candidates in every ancestor directory of the project root,
|
|
520
524
|
* workspace root included. The project's own directory is excluded — files
|
|
521
|
-
* there are covered by the
|
|
522
|
-
* which is its own ancestor and so keeps its
|
|
525
|
+
* there are covered by the in-project ignore-file input — except at the
|
|
526
|
+
* workspace root, which is its own ancestor and so keeps its ignore files.
|
|
523
527
|
*/
|
|
524
|
-
function
|
|
528
|
+
function ancestorIgnorePaths(projectRoot) {
|
|
525
529
|
const result = [];
|
|
526
530
|
let dir = projectRoot === '.' ? '.' : dirname(projectRoot);
|
|
527
531
|
while (true) {
|
|
528
|
-
|
|
532
|
+
for (const filename of IGNORE_FILENAMES) {
|
|
533
|
+
result.push(dir === '.' ? filename : `${dir}/${filename}`);
|
|
534
|
+
}
|
|
529
535
|
if (dir === '.') {
|
|
530
536
|
break;
|
|
531
537
|
}
|
|
@@ -572,19 +578,35 @@ function getProjectUsingOxlintConfig(configFilePath, projectRoot, options, conte
|
|
|
572
578
|
const isRootProject = projectRoot === '.';
|
|
573
579
|
const lintPath = isRootProject && standaloneSrcPath ? `./${standaloneSrcPath}` : '.';
|
|
574
580
|
const jsPluginFiles = new Set(configInputs.flatMap((config) => localJsPluginFiles(config, jsPluginSpecifiersByConfig.get(config) ?? [])));
|
|
581
|
+
const lintableFiles = `{projectRoot}/${LINTABLE_FILES_GLOB}`;
|
|
582
|
+
const usesBoundariesBridge = configInputs.some((config) => (jsPluginSpecifiersByConfig.get(config) ?? []).includes(BOUNDARIES_PLUGIN_SPECIFIER));
|
|
575
583
|
const targetConfig = {
|
|
576
584
|
command: `oxlint ${lintPath}`,
|
|
577
585
|
options: { cwd: projectRoot },
|
|
578
586
|
cache: true,
|
|
579
587
|
inputs: [
|
|
580
|
-
|
|
581
|
-
|
|
588
|
+
// Only what Oxlint can lint, so a README or JSON edit is not a re-lint.
|
|
589
|
+
{ fileset: lintableFiles },
|
|
590
|
+
// The bridge checks the project graph, which a dependency's imports and
|
|
591
|
+
// package.json shape.
|
|
592
|
+
...(usesBoundariesBridge
|
|
593
|
+
? [
|
|
594
|
+
{ fileset: lintableFiles, dependencies: true },
|
|
595
|
+
{
|
|
596
|
+
fileset: '{projectRoot}/package.json',
|
|
597
|
+
dependencies: true,
|
|
598
|
+
},
|
|
599
|
+
]
|
|
600
|
+
: []),
|
|
601
|
+
// Configs, ignore files and tsconfigs inside the project.
|
|
602
|
+
{
|
|
603
|
+
fileset: `{projectRoot}/**/{${[...OXLINT_CONFIG_FILENAMES, ...IGNORE_FILENAMES, 'tsconfig*.json'].join(',')}}`,
|
|
604
|
+
},
|
|
582
605
|
...configInputs.map((config) => `{workspaceRoot}/${config}`),
|
|
583
606
|
...[...jsPluginFiles].map((file) => `{workspaceRoot}/${file}`),
|
|
584
|
-
// Oxlint layers
|
|
585
|
-
//
|
|
586
|
-
|
|
587
|
-
...ancestorEslintignorePaths(projectRoot).map((file) => `{workspaceRoot}/${file}`),
|
|
607
|
+
// Oxlint layers ignore files from every ancestor of a linted file.
|
|
608
|
+
// Declared even when absent, like the extends chain.
|
|
609
|
+
...ancestorIgnorePaths(projectRoot).map((file) => `{workspaceRoot}/${file}`),
|
|
588
610
|
...tsconfigChainOutsideProjectRoot.map((file) => `{workspaceRoot}/${file}`),
|
|
589
611
|
{ externalDependencies: ['oxlint'] },
|
|
590
612
|
],
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/oxlint",
|
|
3
3
|
"description": "Experimental. The Oxlint plugin for Nx contains generators and utilities used for linting JavaScript/TypeScript projects within an Nx workspace.",
|
|
4
|
-
"version": "23.2.0-
|
|
4
|
+
"version": "23.2.0-rc.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist",
|
|
@@ -69,9 +69,9 @@
|
|
|
69
69
|
"generators": "./generators.json",
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"tslib": "^2.3.0",
|
|
72
|
-
"@nx/devkit": "23.2.0-
|
|
73
|
-
"@nx/eslint-plugin": "23.2.0-
|
|
74
|
-
"@nx/js": "23.2.0-
|
|
72
|
+
"@nx/devkit": "23.2.0-rc.1",
|
|
73
|
+
"@nx/eslint-plugin": "23.2.0-rc.1",
|
|
74
|
+
"@nx/js": "23.2.0-rc.1"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
77
|
"oxlint": "^1.43.0"
|
|
@@ -85,6 +85,6 @@
|
|
|
85
85
|
"node": "^20.19.0 || >=22.12.0"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
|
-
"nx": "23.2.0-
|
|
88
|
+
"nx": "23.2.0-rc.1"
|
|
89
89
|
}
|
|
90
90
|
}
|