@cedarjs/cli 1.0.0-canary.12863 → 1.0.0-canary.12865
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/commands/lint.js +63 -3
- package/package.json +11 -11
package/dist/commands/lint.js
CHANGED
|
@@ -1,8 +1,63 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
2
3
|
import execa from "execa";
|
|
3
4
|
import { terminalLink } from "termi-link";
|
|
4
5
|
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
5
|
-
import { getPaths } from "../lib/index.js";
|
|
6
|
+
import { getPaths, getConfig } from "../lib/index.js";
|
|
7
|
+
function detectLegacyEslintConfig() {
|
|
8
|
+
const projectRoot = getPaths().base;
|
|
9
|
+
const legacyConfigFiles = [
|
|
10
|
+
".eslintrc.js",
|
|
11
|
+
".eslintrc.cjs",
|
|
12
|
+
".eslintrc.json",
|
|
13
|
+
".eslintrc.yaml",
|
|
14
|
+
".eslintrc.yml"
|
|
15
|
+
];
|
|
16
|
+
const foundLegacyFiles = [];
|
|
17
|
+
for (const configFile of legacyConfigFiles) {
|
|
18
|
+
if (fs.existsSync(path.join(projectRoot, configFile))) {
|
|
19
|
+
foundLegacyFiles.push(configFile);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const packageJsonPath = path.join(projectRoot, "package.json");
|
|
23
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
24
|
+
try {
|
|
25
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
26
|
+
if (packageJson.eslintConfig) {
|
|
27
|
+
foundLegacyFiles.push("package.json (eslintConfig field)");
|
|
28
|
+
}
|
|
29
|
+
if (packageJson.eslint) {
|
|
30
|
+
foundLegacyFiles.push("package.json (eslint field)");
|
|
31
|
+
}
|
|
32
|
+
} catch (error) {
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return foundLegacyFiles;
|
|
36
|
+
}
|
|
37
|
+
function showLegacyEslintDeprecationWarning(legacyFiles) {
|
|
38
|
+
console.warn("");
|
|
39
|
+
console.warn("\u26A0\uFE0F DEPRECATION WARNING: Legacy ESLint Configuration Detected");
|
|
40
|
+
console.warn("");
|
|
41
|
+
console.warn(" The following legacy ESLint configuration files were found:");
|
|
42
|
+
legacyFiles.forEach((file) => {
|
|
43
|
+
console.warn(` - ${file}`);
|
|
44
|
+
});
|
|
45
|
+
console.warn("");
|
|
46
|
+
console.warn(
|
|
47
|
+
" Cedar has migrated to ESLint flat config format. Legacy configurations"
|
|
48
|
+
);
|
|
49
|
+
console.warn(
|
|
50
|
+
" still work but are deprecated and will be removed in a future version."
|
|
51
|
+
);
|
|
52
|
+
console.warn("");
|
|
53
|
+
console.warn(" To migrate to the new format:");
|
|
54
|
+
console.warn(" 1. Remove the legacy config file(s) listed above");
|
|
55
|
+
console.warn(" 2. Create an eslint.config.mjs");
|
|
56
|
+
console.warn(" 3. Use the flat config format with @cedarjs/eslint-config");
|
|
57
|
+
console.warn("");
|
|
58
|
+
console.warn(" See more here: https://github.com/cedarjs/cedar/pull/629");
|
|
59
|
+
console.warn("");
|
|
60
|
+
}
|
|
6
61
|
const command = "lint [path..]";
|
|
7
62
|
const description = "Lint your files";
|
|
8
63
|
const builder = (yargs) => {
|
|
@@ -24,10 +79,15 @@ const builder = (yargs) => {
|
|
|
24
79
|
)}`
|
|
25
80
|
);
|
|
26
81
|
};
|
|
27
|
-
const handler = async ({ path, fix, format }) => {
|
|
82
|
+
const handler = async ({ path: path2, fix, format }) => {
|
|
28
83
|
recordTelemetryAttributes({ command: "lint", fix, format });
|
|
84
|
+
const config = getConfig();
|
|
85
|
+
const legacyConfigFiles = detectLegacyEslintConfig();
|
|
86
|
+
if (legacyConfigFiles.length > 0 && config.eslintLegacyConfigWarning) {
|
|
87
|
+
showLegacyEslintDeprecationWarning(legacyConfigFiles);
|
|
88
|
+
}
|
|
29
89
|
try {
|
|
30
|
-
const pathString =
|
|
90
|
+
const pathString = path2?.join(" ");
|
|
31
91
|
const sbPath = getPaths().web.storybook;
|
|
32
92
|
const args = [
|
|
33
93
|
"eslint",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/cli",
|
|
3
|
-
"version": "1.0.0-canary.
|
|
3
|
+
"version": "1.0.0-canary.12865+069376989",
|
|
4
4
|
"description": "The CedarJS Command Line",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,15 +31,15 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@babel/preset-typescript": "7.27.1",
|
|
33
33
|
"@babel/runtime-corejs3": "7.27.6",
|
|
34
|
-
"@cedarjs/api-server": "1.0.0-canary.
|
|
35
|
-
"@cedarjs/cli-helpers": "1.0.0-canary.
|
|
36
|
-
"@cedarjs/fastify-web": "1.0.0-canary.
|
|
37
|
-
"@cedarjs/internal": "1.0.0-canary.
|
|
38
|
-
"@cedarjs/prerender": "1.0.0-canary.
|
|
39
|
-
"@cedarjs/project-config": "1.0.0-canary.
|
|
40
|
-
"@cedarjs/structure": "1.0.0-canary.
|
|
41
|
-
"@cedarjs/telemetry": "1.0.0-canary.
|
|
42
|
-
"@cedarjs/web-server": "1.0.0-canary.
|
|
34
|
+
"@cedarjs/api-server": "1.0.0-canary.12865",
|
|
35
|
+
"@cedarjs/cli-helpers": "1.0.0-canary.12865",
|
|
36
|
+
"@cedarjs/fastify-web": "1.0.0-canary.12865",
|
|
37
|
+
"@cedarjs/internal": "1.0.0-canary.12865",
|
|
38
|
+
"@cedarjs/prerender": "1.0.0-canary.12865",
|
|
39
|
+
"@cedarjs/project-config": "1.0.0-canary.12865",
|
|
40
|
+
"@cedarjs/structure": "1.0.0-canary.12865",
|
|
41
|
+
"@cedarjs/telemetry": "1.0.0-canary.12865",
|
|
42
|
+
"@cedarjs/web-server": "1.0.0-canary.12865",
|
|
43
43
|
"@listr2/prompt-adapter-enquirer": "2.0.16",
|
|
44
44
|
"@opentelemetry/api": "1.8.0",
|
|
45
45
|
"@opentelemetry/core": "1.22.0",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"publishConfig": {
|
|
102
102
|
"access": "public"
|
|
103
103
|
},
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "06937698922d15ba34225b47e25849b1c70db4a1"
|
|
105
105
|
}
|