@jsse/eslint-config 0.0.2 → 0.0.4
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 +52 -39
- package/dist/cli.js +28 -33
- package/dist/index.cjs +9384 -370
- package/dist/index.d.cts +21 -1
- package/dist/index.d.ts +21 -1
- package/dist/index.js +9281 -211
- package/package.json +10 -10
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
|
@@ -1,13 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
9
24
|
|
|
10
25
|
// src/cli.ts
|
|
26
|
+
var import_node_fs = __toESM(require("fs"), 1);
|
|
27
|
+
|
|
28
|
+
// node_modules/.pnpm/cac@6.7.14/node_modules/cac/dist/index.mjs
|
|
29
|
+
var import_events = require("events");
|
|
11
30
|
function toArr(any) {
|
|
12
31
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
13
32
|
}
|
|
@@ -407,7 +426,7 @@ var GlobalCommand = class extends Command {
|
|
|
407
426
|
}
|
|
408
427
|
};
|
|
409
428
|
var __assign = Object.assign;
|
|
410
|
-
var CAC = class extends
|
|
429
|
+
var CAC = class extends import_events.EventEmitter {
|
|
411
430
|
constructor(name = "") {
|
|
412
431
|
super();
|
|
413
432
|
this.name = name;
|
|
@@ -597,7 +616,7 @@ var CAC = class extends events.EventEmitter {
|
|
|
597
616
|
var cac = (name = "") => new CAC(name);
|
|
598
617
|
|
|
599
618
|
// package.json
|
|
600
|
-
var version = "0.0.
|
|
619
|
+
var version = "0.0.4";
|
|
601
620
|
|
|
602
621
|
// src/cli.ts
|
|
603
622
|
var cli = cac("jsselint");
|
|
@@ -625,37 +644,31 @@ export default jsse(
|
|
|
625
644
|
}
|
|
626
645
|
);
|
|
627
646
|
`;
|
|
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);
|
|
647
|
+
cli.command("init", "create eslint config file").option("--force", "force create eslint config file").action(async (options) => {
|
|
648
|
+
console.log("init");
|
|
649
|
+
const configPath = "eslint.config.js";
|
|
650
|
+
if (import_node_fs.default.existsSync(configPath)) {
|
|
651
|
+
const msg = "eslint.config.js already exists";
|
|
652
|
+
console.warn(msg);
|
|
653
|
+
if (!options.force) {
|
|
645
654
|
throw new Error(msg);
|
|
646
655
|
}
|
|
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
656
|
}
|
|
658
|
-
)
|
|
657
|
+
if (!import_node_fs.default.existsSync("package.json")) {
|
|
658
|
+
const msg = "package.json not found";
|
|
659
|
+
console.warn(msg);
|
|
660
|
+
throw new Error(msg);
|
|
661
|
+
}
|
|
662
|
+
const packageJson = JSON.parse(import_node_fs.default.readFileSync("package.json", "utf-8"));
|
|
663
|
+
const isModule = packageJson.type === "module";
|
|
664
|
+
const eslintConfigString = [
|
|
665
|
+
isModule ? configStringEsm : configStringCjs,
|
|
666
|
+
"/* ALT */",
|
|
667
|
+
(isModule ? configStringCjs : configStringEsm).split("\n").map((line) => `// ${line}`).join("\n")
|
|
668
|
+
];
|
|
669
|
+
import_node_fs.default.writeFileSync(configPath, eslintConfigString.join("\n"));
|
|
670
|
+
console.log(`made eslint.config.js (type: ${packageJson.type})`);
|
|
671
|
+
});
|
|
659
672
|
cli.help();
|
|
660
|
-
cli.version(version );
|
|
673
|
+
cli.version(typeof version === "string" ? version : "unknown");
|
|
661
674
|
cli.parse();
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import { EventEmitter } from 'events';
|
|
3
|
-
|
|
4
1
|
// src/cli.ts
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
|
|
4
|
+
// node_modules/.pnpm/cac@6.7.14/node_modules/cac/dist/index.mjs
|
|
5
|
+
import { EventEmitter } from "events";
|
|
5
6
|
function toArr(any) {
|
|
6
7
|
return any == null ? [] : Array.isArray(any) ? any : [any];
|
|
7
8
|
}
|
|
@@ -591,7 +592,7 @@ var CAC = class extends EventEmitter {
|
|
|
591
592
|
var cac = (name = "") => new CAC(name);
|
|
592
593
|
|
|
593
594
|
// package.json
|
|
594
|
-
var version = "0.0.
|
|
595
|
+
var version = "0.0.4";
|
|
595
596
|
|
|
596
597
|
// src/cli.ts
|
|
597
598
|
var cli = cac("jsselint");
|
|
@@ -619,37 +620,31 @@ export default jsse(
|
|
|
619
620
|
}
|
|
620
621
|
);
|
|
621
622
|
`;
|
|
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);
|
|
623
|
+
cli.command("init", "create eslint config file").option("--force", "force create eslint config file").action(async (options) => {
|
|
624
|
+
console.log("init");
|
|
625
|
+
const configPath = "eslint.config.js";
|
|
626
|
+
if (fs.existsSync(configPath)) {
|
|
627
|
+
const msg = "eslint.config.js already exists";
|
|
628
|
+
console.warn(msg);
|
|
629
|
+
if (!options.force) {
|
|
639
630
|
throw new Error(msg);
|
|
640
631
|
}
|
|
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
632
|
}
|
|
652
|
-
)
|
|
633
|
+
if (!fs.existsSync("package.json")) {
|
|
634
|
+
const msg = "package.json not found";
|
|
635
|
+
console.warn(msg);
|
|
636
|
+
throw new Error(msg);
|
|
637
|
+
}
|
|
638
|
+
const packageJson = JSON.parse(fs.readFileSync("package.json", "utf-8"));
|
|
639
|
+
const isModule = packageJson.type === "module";
|
|
640
|
+
const eslintConfigString = [
|
|
641
|
+
isModule ? configStringEsm : configStringCjs,
|
|
642
|
+
"/* ALT */",
|
|
643
|
+
(isModule ? configStringCjs : configStringEsm).split("\n").map((line) => `// ${line}`).join("\n")
|
|
644
|
+
];
|
|
645
|
+
fs.writeFileSync(configPath, eslintConfigString.join("\n"));
|
|
646
|
+
console.log(`made eslint.config.js (type: ${packageJson.type})`);
|
|
647
|
+
});
|
|
653
648
|
cli.help();
|
|
654
|
-
cli.version(version );
|
|
649
|
+
cli.version(typeof version === "string" ? version : "unknown");
|
|
655
650
|
cli.parse();
|