@jsse/eslint-config 0.0.2 → 0.0.3
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 +14 -18
- package/dist/cli.cjs +23 -29
- package/dist/cli.js +23 -29
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,30 +28,26 @@ With [`"type": "module"`](https://nodejs.org/api/packages.html#type) in `package
|
|
|
28
28
|
// eslint.config.js
|
|
29
29
|
import jsse from "@jsse/eslint-config";
|
|
30
30
|
|
|
31
|
-
export default jsse(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
);
|
|
31
|
+
export default jsse({
|
|
32
|
+
// options
|
|
33
|
+
// typescript: {
|
|
34
|
+
// tsconfigPath: "tsconfig.json", // or ["tsconfig.json", "tsconfig.eslint.json", ...]
|
|
35
|
+
// },
|
|
36
|
+
// react: true
|
|
37
|
+
});
|
|
40
38
|
```
|
|
41
39
|
|
|
42
40
|
With CJS:
|
|
43
41
|
|
|
44
42
|
```js
|
|
45
43
|
// eslint.config.js
|
|
46
|
-
module.exports = require("@jsse/eslint-config").jsse(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
)
|
|
44
|
+
module.exports = require("@jsse/eslint-config").jsse({
|
|
45
|
+
// options
|
|
46
|
+
// typescript: {
|
|
47
|
+
// tsconfigPath: "tsconfig.json", // or ["tsconfig.json", "tsconfig.eslint.json", ...]
|
|
48
|
+
// },
|
|
49
|
+
// react: true
|
|
50
|
+
});
|
|
55
51
|
```
|
|
56
52
|
|
|
57
53
|
> Note that `.eslintignore` no longer works in Flat config, see [customization](#customization) for more details.
|
package/dist/cli.cjs
CHANGED
|
@@ -597,7 +597,7 @@ var CAC = class extends events.EventEmitter {
|
|
|
597
597
|
var cac = (name = "") => new CAC(name);
|
|
598
598
|
|
|
599
599
|
// package.json
|
|
600
|
-
var version = "0.0.
|
|
600
|
+
var version = "0.0.3";
|
|
601
601
|
|
|
602
602
|
// src/cli.ts
|
|
603
603
|
var cli = cac("jsselint");
|
|
@@ -625,37 +625,31 @@ export default jsse(
|
|
|
625
625
|
}
|
|
626
626
|
);
|
|
627
627
|
`;
|
|
628
|
-
cli.command("init", "create eslint config file").option(
|
|
629
|
-
"
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
console.
|
|
634
|
-
|
|
635
|
-
if (fs__default.default.existsSync(configPath)) {
|
|
636
|
-
const msg = "eslint.config.js already exists";
|
|
637
|
-
console.warn(msg);
|
|
638
|
-
if (!options.force) {
|
|
639
|
-
throw new Error(msg);
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
if (!fs__default.default.existsSync("package.json")) {
|
|
643
|
-
const msg = "package.json not found";
|
|
644
|
-
console.warn(msg);
|
|
628
|
+
cli.command("init", "create eslint config file").option("--force", "force create eslint config file").action(async (options) => {
|
|
629
|
+
console.log("init");
|
|
630
|
+
const configPath = "eslint.config.js";
|
|
631
|
+
if (fs__default.default.existsSync(configPath)) {
|
|
632
|
+
const msg = "eslint.config.js already exists";
|
|
633
|
+
console.warn(msg);
|
|
634
|
+
if (!options.force) {
|
|
645
635
|
throw new Error(msg);
|
|
646
636
|
}
|
|
647
|
-
const packageJson = JSON.parse(fs__default.default.readFileSync("package.json", "utf-8"));
|
|
648
|
-
const isModule = packageJson.type === "module";
|
|
649
|
-
const eslintConfigString = [
|
|
650
|
-
isModule ? configStringEsm : configStringCjs,
|
|
651
|
-
"/* ALT */",
|
|
652
|
-
(isModule ? configStringCjs : configStringEsm).split("\n").map((line) => `// ${line}`).join("\n")
|
|
653
|
-
];
|
|
654
|
-
fs__default.default.writeFileSync(configPath, eslintConfigString.join("\n"));
|
|
655
|
-
console.log(`made eslint.config.js (type: ${packageJson.type})`);
|
|
656
|
-
fs__default.default.writeFileSync(configPath, configStringCjs);
|
|
657
637
|
}
|
|
658
|
-
)
|
|
638
|
+
if (!fs__default.default.existsSync("package.json")) {
|
|
639
|
+
const msg = "package.json not found";
|
|
640
|
+
console.warn(msg);
|
|
641
|
+
throw new Error(msg);
|
|
642
|
+
}
|
|
643
|
+
const packageJson = JSON.parse(fs__default.default.readFileSync("package.json", "utf-8"));
|
|
644
|
+
const isModule = packageJson.type === "module";
|
|
645
|
+
const eslintConfigString = [
|
|
646
|
+
isModule ? configStringEsm : configStringCjs,
|
|
647
|
+
"/* ALT */",
|
|
648
|
+
(isModule ? configStringCjs : configStringEsm).split("\n").map((line) => `// ${line}`).join("\n")
|
|
649
|
+
];
|
|
650
|
+
fs__default.default.writeFileSync(configPath, eslintConfigString.join("\n"));
|
|
651
|
+
console.log(`made eslint.config.js (type: ${packageJson.type})`);
|
|
652
|
+
});
|
|
659
653
|
cli.help();
|
|
660
654
|
cli.version(version );
|
|
661
655
|
cli.parse();
|
package/dist/cli.js
CHANGED
|
@@ -591,7 +591,7 @@ var CAC = class extends EventEmitter {
|
|
|
591
591
|
var cac = (name = "") => new CAC(name);
|
|
592
592
|
|
|
593
593
|
// package.json
|
|
594
|
-
var version = "0.0.
|
|
594
|
+
var version = "0.0.3";
|
|
595
595
|
|
|
596
596
|
// src/cli.ts
|
|
597
597
|
var cli = cac("jsselint");
|
|
@@ -619,37 +619,31 @@ export default jsse(
|
|
|
619
619
|
}
|
|
620
620
|
);
|
|
621
621
|
`;
|
|
622
|
-
cli.command("init", "create eslint config file").option(
|
|
623
|
-
"
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
console.
|
|
628
|
-
|
|
629
|
-
if (fs.existsSync(configPath)) {
|
|
630
|
-
const msg = "eslint.config.js already exists";
|
|
631
|
-
console.warn(msg);
|
|
632
|
-
if (!options.force) {
|
|
633
|
-
throw new Error(msg);
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
if (!fs.existsSync("package.json")) {
|
|
637
|
-
const msg = "package.json not found";
|
|
638
|
-
console.warn(msg);
|
|
622
|
+
cli.command("init", "create eslint config file").option("--force", "force create eslint config file").action(async (options) => {
|
|
623
|
+
console.log("init");
|
|
624
|
+
const configPath = "eslint.config.js";
|
|
625
|
+
if (fs.existsSync(configPath)) {
|
|
626
|
+
const msg = "eslint.config.js already exists";
|
|
627
|
+
console.warn(msg);
|
|
628
|
+
if (!options.force) {
|
|
639
629
|
throw new Error(msg);
|
|
640
630
|
}
|
|
641
|
-
const packageJson = JSON.parse(fs.readFileSync("package.json", "utf-8"));
|
|
642
|
-
const isModule = packageJson.type === "module";
|
|
643
|
-
const eslintConfigString = [
|
|
644
|
-
isModule ? configStringEsm : configStringCjs,
|
|
645
|
-
"/* ALT */",
|
|
646
|
-
(isModule ? configStringCjs : configStringEsm).split("\n").map((line) => `// ${line}`).join("\n")
|
|
647
|
-
];
|
|
648
|
-
fs.writeFileSync(configPath, eslintConfigString.join("\n"));
|
|
649
|
-
console.log(`made eslint.config.js (type: ${packageJson.type})`);
|
|
650
|
-
fs.writeFileSync(configPath, configStringCjs);
|
|
651
631
|
}
|
|
652
|
-
)
|
|
632
|
+
if (!fs.existsSync("package.json")) {
|
|
633
|
+
const msg = "package.json not found";
|
|
634
|
+
console.warn(msg);
|
|
635
|
+
throw new Error(msg);
|
|
636
|
+
}
|
|
637
|
+
const packageJson = JSON.parse(fs.readFileSync("package.json", "utf-8"));
|
|
638
|
+
const isModule = packageJson.type === "module";
|
|
639
|
+
const eslintConfigString = [
|
|
640
|
+
isModule ? configStringEsm : configStringCjs,
|
|
641
|
+
"/* ALT */",
|
|
642
|
+
(isModule ? configStringCjs : configStringEsm).split("\n").map((line) => `// ${line}`).join("\n")
|
|
643
|
+
];
|
|
644
|
+
fs.writeFileSync(configPath, eslintConfigString.join("\n"));
|
|
645
|
+
console.log(`made eslint.config.js (type: ${packageJson.type})`);
|
|
646
|
+
});
|
|
653
647
|
cli.help();
|
|
654
648
|
cli.version(version );
|
|
655
649
|
cli.parse();
|
package/package.json
CHANGED