@culur/config-eslint 0.0.0-dev-20240527064403
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/CHANGELOG.md +13 -0
- package/README.md +76 -0
- package/dist/chunk-4NIL3QOR.cjs +8 -0
- package/dist/chunk-4NIL3QOR.cjs.map +1 -0
- package/dist/chunk-N7KES6RB.js +83 -0
- package/dist/chunk-N7KES6RB.js.map +1 -0
- package/dist/chunk-QYDW5TS2.js +17 -0
- package/dist/chunk-QYDW5TS2.js.map +1 -0
- package/dist/chunk-TZB7IM2G.cjs +19 -0
- package/dist/chunk-TZB7IM2G.cjs.map +1 -0
- package/dist/chunk-WJDZNLOH.js +6 -0
- package/dist/chunk-WJDZNLOH.js.map +1 -0
- package/dist/chunk-ZIJ5OQW5.cjs +89 -0
- package/dist/chunk-ZIJ5OQW5.cjs.map +1 -0
- package/dist/index.cjs +27 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/overrides/sort-package-json.cjs +12 -0
- package/dist/overrides/sort-package-json.cjs.map +1 -0
- package/dist/overrides/sort-package-json.d.cts +6 -0
- package/dist/overrides/sort-package-json.d.ts +6 -0
- package/dist/overrides/sort-package-json.js +3 -0
- package/dist/overrides/sort-package-json.js.map +1 -0
- package/dist/overrides/types.cjs +12 -0
- package/dist/overrides/types.cjs.map +1 -0
- package/dist/overrides/types.d.cts +9 -0
- package/dist/overrides/types.d.ts +9 -0
- package/dist/overrides/types.js +3 -0
- package/dist/overrides/types.js.map +1 -0
- package/dist/rules/unicorn-filename-case.cjs +12 -0
- package/dist/rules/unicorn-filename-case.cjs.map +1 -0
- package/dist/rules/unicorn-filename-case.d.cts +5 -0
- package/dist/rules/unicorn-filename-case.d.ts +5 -0
- package/dist/rules/unicorn-filename-case.js +3 -0
- package/dist/rules/unicorn-filename-case.js.map +1 -0
- package/package.json +81 -0
- package/src/index.test.ts +10 -0
- package/src/index.ts +19 -0
- package/src/overrides/sort-package-json.test.ts +25 -0
- package/src/overrides/sort-package-json.ts +92 -0
- package/src/overrides/types.test.ts +25 -0
- package/src/overrides/types.ts +9 -0
- package/src/rules/unicorn-filename-case.test.ts +7 -0
- package/src/rules/unicorn-filename-case.ts +14 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @culur/config-eslint
|
|
2
|
+
|
|
3
|
+
## 0.0.0-dev-20240527064403
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#18](https://github.com/culur/culur/pull/18) [`622888f`](https://github.com/culur/culur/commit/622888fa6d4a31ac275b435a74c29cd0b986f974) Thanks [@github-actions](https://github.com/apps/github-actions)! - Update dependencies version
|
|
8
|
+
|
|
9
|
+
## 1.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- [`210d07d`](https://github.com/culur/culur/commit/210d07d7ca6046807a2ff18011635c3b280dd707) Thanks [@phamhongphuc](https://github.com/phamhongphuc)! - First release
|
package/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# `@culur/config-eslint`
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@culur/config-eslint)
|
|
4
|
+
[](https://www.npmjs.com/package/@culur/config-eslint)
|
|
5
|
+
[](../../LICENSE)
|
|
6
|
+
|
|
7
|
+
[](https://www.codefactor.io/repository/github/culur/culur)
|
|
8
|
+
[](https://app.codecov.io/gh/culur/culur)
|
|
9
|
+
[](https://github.com/culur/culur/actions/workflows/build-and-release.yml)
|
|
10
|
+
|
|
11
|
+
> Sharing [Eslint](https://eslint.org/) configurations.
|
|
12
|
+
|
|
13
|
+
## 💿 Installation
|
|
14
|
+
|
|
15
|
+
Add `@culur/config-eslint` dependency to your project.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Using npm
|
|
19
|
+
npm install @culur/config-eslint --save-dev
|
|
20
|
+
|
|
21
|
+
# Using yarn
|
|
22
|
+
yarn add @culur/config-eslint --dev
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Other packages:
|
|
26
|
+
|
|
27
|
+
- Use need to install `eslint` package in devDependencies.
|
|
28
|
+
- For `inspector`, you can install `eslint-config-inspector` in devDependencies.
|
|
29
|
+
|
|
30
|
+
## 📖 Usage
|
|
31
|
+
|
|
32
|
+
In `eslint.config.js`, use `defineConfig`:
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
// .eslint.config.cjs
|
|
36
|
+
const defineConfig = require('@culur/config-eslint');
|
|
37
|
+
|
|
38
|
+
module.exports = defineConfig();
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
// .eslint.config.mjs
|
|
43
|
+
import defineConfig from '@culur/config-eslint';
|
|
44
|
+
|
|
45
|
+
export default defineConfig();
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 📜 Scripts
|
|
49
|
+
|
|
50
|
+
Some commonly used scripts in `package.json`.
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"scripts": {
|
|
55
|
+
"fix:es": "eslint --fix",
|
|
56
|
+
"lint:es": "eslint",
|
|
57
|
+
"lint:es-in": "eslint-config-inspector"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## ✨ Features
|
|
63
|
+
|
|
64
|
+
The library is a shareable Eslint configuration. It has some key features as follows:
|
|
65
|
+
|
|
66
|
+
- Extends all config from [`@antfu/eslint-config`](https://github.com/antfu/eslint-config).
|
|
67
|
+
- Override and add some rules according to personal opinion.
|
|
68
|
+
- Full customizable (use the same functions as `@antfu/eslint-config`).
|
|
69
|
+
|
|
70
|
+
## 🗃️ Changelog
|
|
71
|
+
|
|
72
|
+
See [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
|
|
73
|
+
|
|
74
|
+
## 🔒 License
|
|
75
|
+
|
|
76
|
+
See [LICENSE](../../LICENSE) for license rights and limitations (MIT).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/overrides/types.ts"],"names":[],"mappings":";AAOO,IAAM,iBAAiB,CAAC,EAAE,MAAM,OAAO,MAC5C,CAAC,MAAM,MAAM","sourcesContent":["import type { Awaitable, TypedFlatConfigItem } from '@antfu/eslint-config';\n\nexport interface OverrideConfig {\n name: NonNullable<TypedFlatConfigItem['name']>;\n config: TypedFlatConfigItem | (() => Awaitable<TypedFlatConfigItem>);\n}\n\nexport const defineOverride = ({ name, config }: OverrideConfig) =>\n [name, config] as const;\n"]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import assert from 'assert';
|
|
2
|
+
import { sortPackageJson as sortPackageJson$1 } from '@antfu/eslint-config';
|
|
3
|
+
|
|
4
|
+
// src/overrides/sort-package-json.ts
|
|
5
|
+
var sortPackageJson = {
|
|
6
|
+
name: "antfu/sort/package-json",
|
|
7
|
+
async config() {
|
|
8
|
+
const [configItem] = await sortPackageJson$1();
|
|
9
|
+
assert(typeof configItem.name === "string");
|
|
10
|
+
assert(typeof configItem.rules === "object");
|
|
11
|
+
const sortKeys = configItem.rules["jsonc/sort-keys"];
|
|
12
|
+
assert(typeof sortKeys === "object");
|
|
13
|
+
const [, options] = sortKeys;
|
|
14
|
+
assert(typeof options === "object");
|
|
15
|
+
options.order = [
|
|
16
|
+
//? Project
|
|
17
|
+
"publisher",
|
|
18
|
+
"name",
|
|
19
|
+
"displayName",
|
|
20
|
+
"version",
|
|
21
|
+
"description",
|
|
22
|
+
"private",
|
|
23
|
+
"publishConfig",
|
|
24
|
+
//? Repository
|
|
25
|
+
"repository",
|
|
26
|
+
"bugs",
|
|
27
|
+
"homepage",
|
|
28
|
+
"funding",
|
|
29
|
+
//? Author & license
|
|
30
|
+
"contributors",
|
|
31
|
+
"author",
|
|
32
|
+
"license",
|
|
33
|
+
//? https://code.visualstudio.com/api/references/extension-manifest
|
|
34
|
+
"keywords",
|
|
35
|
+
"categories",
|
|
36
|
+
//? CDN
|
|
37
|
+
"unpkg",
|
|
38
|
+
"jsdelivr",
|
|
39
|
+
//? Export
|
|
40
|
+
"type",
|
|
41
|
+
// module or commonjs
|
|
42
|
+
"main",
|
|
43
|
+
"types",
|
|
44
|
+
"typings",
|
|
45
|
+
// synonymous with types
|
|
46
|
+
"typesVersions",
|
|
47
|
+
"exports",
|
|
48
|
+
"bin",
|
|
49
|
+
"files",
|
|
50
|
+
"workspaces",
|
|
51
|
+
//? https://code.visualstudio.com/api/references/extension-manifest
|
|
52
|
+
"icon",
|
|
53
|
+
"activationEvents",
|
|
54
|
+
"contributes",
|
|
55
|
+
//? Scripts
|
|
56
|
+
"scripts",
|
|
57
|
+
//? Node & packageManager
|
|
58
|
+
"volta",
|
|
59
|
+
"engines",
|
|
60
|
+
"packageManager",
|
|
61
|
+
//? Dependencies
|
|
62
|
+
"dependencies",
|
|
63
|
+
"devDependencies",
|
|
64
|
+
"peerDependencies",
|
|
65
|
+
"peerDependenciesMeta",
|
|
66
|
+
"bundleDependencies",
|
|
67
|
+
"optionalDependencies",
|
|
68
|
+
"pnpm",
|
|
69
|
+
"overrides",
|
|
70
|
+
"resolutions",
|
|
71
|
+
//? Lib config
|
|
72
|
+
"husky",
|
|
73
|
+
"simple-git-hooks",
|
|
74
|
+
"lint-staged",
|
|
75
|
+
"eslintConfig"
|
|
76
|
+
];
|
|
77
|
+
return configItem;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export { sortPackageJson };
|
|
82
|
+
//# sourceMappingURL=out.js.map
|
|
83
|
+
//# sourceMappingURL=chunk-N7KES6RB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/overrides/sort-package-json.ts"],"names":[],"mappings":";AAAA,OAAO,YAAY;AACnB,SAAS,mBAAmB,4BAA4B;AAGjD,IAAM,kBAAkC;AAAA,EAC7C,MAAM;AAAA,EACN,MAAM,SAAS;AACb,UAAM,CAAC,UAAU,IAAI,MAAM,qBAAqB;AAChD,WAAO,OAAO,WAAW,SAAS,QAAQ;AAC1C,WAAO,OAAO,WAAW,UAAU,QAAQ;AAE3C,UAAM,WAAW,WAAW,MAAM,iBAAiB;AACnD,WAAO,OAAO,aAAa,QAAQ;AAEnC,UAAM,CAAC,EAAE,OAAO,IAAI;AACpB,WAAO,OAAO,YAAY,QAAQ;AAElC,YAAQ,QAAQ;AAAA;AAAA,MAEd;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MAGA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MAGA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MAGA;AAAA,MACA;AAAA;AAAA,MAGA;AAAA,MACA;AAAA;AAAA,MAGA;AAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MAGA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MAGA;AAAA;AAAA,MAGA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MAGA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MAGA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AACF","sourcesContent":["import assert from 'node:assert';\nimport { sortPackageJson as sortPackageJsonAntfu } from '@antfu/eslint-config';\nimport type { OverrideConfig } from './types';\n\nexport const sortPackageJson: OverrideConfig = {\n name: 'antfu/sort/package-json',\n async config() {\n const [configItem] = await sortPackageJsonAntfu();\n assert(typeof configItem.name === 'string');\n assert(typeof configItem.rules === 'object');\n\n const sortKeys = configItem.rules['jsonc/sort-keys'];\n assert(typeof sortKeys === 'object');\n\n const [, options] = sortKeys;\n assert(typeof options === 'object');\n\n options.order = [\n //? Project\n 'publisher',\n 'name',\n 'displayName',\n 'version',\n 'description',\n 'private',\n 'publishConfig',\n\n //? Repository\n 'repository',\n 'bugs',\n 'homepage',\n 'funding',\n\n //? Author & license\n 'contributors',\n 'author',\n 'license',\n\n //? https://code.visualstudio.com/api/references/extension-manifest\n 'keywords',\n 'categories',\n\n //? CDN\n 'unpkg',\n 'jsdelivr',\n\n //? Export\n 'type', // module or commonjs\n 'main',\n 'types',\n 'typings', // synonymous with types\n 'typesVersions',\n 'exports',\n 'bin',\n 'files',\n 'workspaces',\n\n //? https://code.visualstudio.com/api/references/extension-manifest\n 'icon',\n 'activationEvents',\n 'contributes',\n\n //? Scripts\n 'scripts',\n\n //? Node & packageManager\n 'volta',\n 'engines',\n 'packageManager',\n\n //? Dependencies\n 'dependencies',\n 'devDependencies',\n 'peerDependencies',\n 'peerDependenciesMeta',\n 'bundleDependencies',\n 'optionalDependencies',\n\n 'pnpm',\n 'overrides',\n 'resolutions',\n\n //? Lib config\n 'husky',\n 'simple-git-hooks',\n 'lint-staged',\n 'eslintConfig',\n ];\n\n return configItem;\n },\n};\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/rules/unicorn-filename-case.ts
|
|
2
|
+
var unicornFilenameCase = {
|
|
3
|
+
files: ["**/*.ts", "**/*.js"],
|
|
4
|
+
rules: {
|
|
5
|
+
"unicorn/filename-case": [
|
|
6
|
+
"error",
|
|
7
|
+
{
|
|
8
|
+
case: "kebabCase",
|
|
9
|
+
ignore: ["README.md"]
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { unicornFilenameCase };
|
|
16
|
+
//# sourceMappingURL=out.js.map
|
|
17
|
+
//# sourceMappingURL=chunk-QYDW5TS2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/rules/unicorn-filename-case.ts"],"names":[],"mappings":";AAEO,IAAM,sBAA2C;AAAA,EACtD,OAAO,CAAC,WAAW,SAAS;AAAA,EAC5B,OAAO;AAAA,IACL,yBAAyB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,QAAQ,CAAC,WAAW;AAAA,MACtB;AAAA,IACF;AAAA,EACF;AACF","sourcesContent":["import type { TypedFlatConfigItem } from '@antfu/eslint-config';\n\nexport const unicornFilenameCase: TypedFlatConfigItem = {\n files: ['**/*.ts', '**/*.js'],\n rules: {\n 'unicorn/filename-case': [\n 'error',\n {\n case: 'kebabCase',\n ignore: ['README.md'],\n },\n ],\n },\n};\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/rules/unicorn-filename-case.ts
|
|
4
|
+
var unicornFilenameCase = {
|
|
5
|
+
files: ["**/*.ts", "**/*.js"],
|
|
6
|
+
rules: {
|
|
7
|
+
"unicorn/filename-case": [
|
|
8
|
+
"error",
|
|
9
|
+
{
|
|
10
|
+
case: "kebabCase",
|
|
11
|
+
ignore: ["README.md"]
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.unicornFilenameCase = unicornFilenameCase;
|
|
18
|
+
//# sourceMappingURL=out.js.map
|
|
19
|
+
//# sourceMappingURL=chunk-TZB7IM2G.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/rules/unicorn-filename-case.ts"],"names":[],"mappings":";AAEO,IAAM,sBAA2C;AAAA,EACtD,OAAO,CAAC,WAAW,SAAS;AAAA,EAC5B,OAAO;AAAA,IACL,yBAAyB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,QAAQ,CAAC,WAAW;AAAA,MACtB;AAAA,IACF;AAAA,EACF;AACF","sourcesContent":["import type { TypedFlatConfigItem } from '@antfu/eslint-config';\n\nexport const unicornFilenameCase: TypedFlatConfigItem = {\n files: ['**/*.ts', '**/*.js'],\n rules: {\n 'unicorn/filename-case': [\n 'error',\n {\n case: 'kebabCase',\n ignore: ['README.md'],\n },\n ],\n },\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/overrides/types.ts"],"names":[],"mappings":";AAOO,IAAM,iBAAiB,CAAC,EAAE,MAAM,OAAO,MAC5C,CAAC,MAAM,MAAM","sourcesContent":["import type { Awaitable, TypedFlatConfigItem } from '@antfu/eslint-config';\n\nexport interface OverrideConfig {\n name: NonNullable<TypedFlatConfigItem['name']>;\n config: TypedFlatConfigItem | (() => Awaitable<TypedFlatConfigItem>);\n}\n\nexport const defineOverride = ({ name, config }: OverrideConfig) =>\n [name, config] as const;\n"]}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var assert = require('assert');
|
|
4
|
+
var eslintConfig = require('@antfu/eslint-config');
|
|
5
|
+
|
|
6
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
|
|
8
|
+
var assert__default = /*#__PURE__*/_interopDefault(assert);
|
|
9
|
+
|
|
10
|
+
// src/overrides/sort-package-json.ts
|
|
11
|
+
var sortPackageJson = {
|
|
12
|
+
name: "antfu/sort/package-json",
|
|
13
|
+
async config() {
|
|
14
|
+
const [configItem] = await eslintConfig.sortPackageJson();
|
|
15
|
+
assert__default.default(typeof configItem.name === "string");
|
|
16
|
+
assert__default.default(typeof configItem.rules === "object");
|
|
17
|
+
const sortKeys = configItem.rules["jsonc/sort-keys"];
|
|
18
|
+
assert__default.default(typeof sortKeys === "object");
|
|
19
|
+
const [, options] = sortKeys;
|
|
20
|
+
assert__default.default(typeof options === "object");
|
|
21
|
+
options.order = [
|
|
22
|
+
//? Project
|
|
23
|
+
"publisher",
|
|
24
|
+
"name",
|
|
25
|
+
"displayName",
|
|
26
|
+
"version",
|
|
27
|
+
"description",
|
|
28
|
+
"private",
|
|
29
|
+
"publishConfig",
|
|
30
|
+
//? Repository
|
|
31
|
+
"repository",
|
|
32
|
+
"bugs",
|
|
33
|
+
"homepage",
|
|
34
|
+
"funding",
|
|
35
|
+
//? Author & license
|
|
36
|
+
"contributors",
|
|
37
|
+
"author",
|
|
38
|
+
"license",
|
|
39
|
+
//? https://code.visualstudio.com/api/references/extension-manifest
|
|
40
|
+
"keywords",
|
|
41
|
+
"categories",
|
|
42
|
+
//? CDN
|
|
43
|
+
"unpkg",
|
|
44
|
+
"jsdelivr",
|
|
45
|
+
//? Export
|
|
46
|
+
"type",
|
|
47
|
+
// module or commonjs
|
|
48
|
+
"main",
|
|
49
|
+
"types",
|
|
50
|
+
"typings",
|
|
51
|
+
// synonymous with types
|
|
52
|
+
"typesVersions",
|
|
53
|
+
"exports",
|
|
54
|
+
"bin",
|
|
55
|
+
"files",
|
|
56
|
+
"workspaces",
|
|
57
|
+
//? https://code.visualstudio.com/api/references/extension-manifest
|
|
58
|
+
"icon",
|
|
59
|
+
"activationEvents",
|
|
60
|
+
"contributes",
|
|
61
|
+
//? Scripts
|
|
62
|
+
"scripts",
|
|
63
|
+
//? Node & packageManager
|
|
64
|
+
"volta",
|
|
65
|
+
"engines",
|
|
66
|
+
"packageManager",
|
|
67
|
+
//? Dependencies
|
|
68
|
+
"dependencies",
|
|
69
|
+
"devDependencies",
|
|
70
|
+
"peerDependencies",
|
|
71
|
+
"peerDependenciesMeta",
|
|
72
|
+
"bundleDependencies",
|
|
73
|
+
"optionalDependencies",
|
|
74
|
+
"pnpm",
|
|
75
|
+
"overrides",
|
|
76
|
+
"resolutions",
|
|
77
|
+
//? Lib config
|
|
78
|
+
"husky",
|
|
79
|
+
"simple-git-hooks",
|
|
80
|
+
"lint-staged",
|
|
81
|
+
"eslintConfig"
|
|
82
|
+
];
|
|
83
|
+
return configItem;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
exports.sortPackageJson = sortPackageJson;
|
|
88
|
+
//# sourceMappingURL=out.js.map
|
|
89
|
+
//# sourceMappingURL=chunk-ZIJ5OQW5.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/overrides/sort-package-json.ts"],"names":[],"mappings":";AAAA,OAAO,YAAY;AACnB,SAAS,mBAAmB,4BAA4B;AAGjD,IAAM,kBAAkC;AAAA,EAC7C,MAAM;AAAA,EACN,MAAM,SAAS;AACb,UAAM,CAAC,UAAU,IAAI,MAAM,qBAAqB;AAChD,WAAO,OAAO,WAAW,SAAS,QAAQ;AAC1C,WAAO,OAAO,WAAW,UAAU,QAAQ;AAE3C,UAAM,WAAW,WAAW,MAAM,iBAAiB;AACnD,WAAO,OAAO,aAAa,QAAQ;AAEnC,UAAM,CAAC,EAAE,OAAO,IAAI;AACpB,WAAO,OAAO,YAAY,QAAQ;AAElC,YAAQ,QAAQ;AAAA;AAAA,MAEd;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MAGA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MAGA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MAGA;AAAA,MACA;AAAA;AAAA,MAGA;AAAA,MACA;AAAA;AAAA,MAGA;AAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MAGA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MAGA;AAAA;AAAA,MAGA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MAGA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MAGA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AACF","sourcesContent":["import assert from 'node:assert';\nimport { sortPackageJson as sortPackageJsonAntfu } from '@antfu/eslint-config';\nimport type { OverrideConfig } from './types';\n\nexport const sortPackageJson: OverrideConfig = {\n name: 'antfu/sort/package-json',\n async config() {\n const [configItem] = await sortPackageJsonAntfu();\n assert(typeof configItem.name === 'string');\n assert(typeof configItem.rules === 'object');\n\n const sortKeys = configItem.rules['jsonc/sort-keys'];\n assert(typeof sortKeys === 'object');\n\n const [, options] = sortKeys;\n assert(typeof options === 'object');\n\n options.order = [\n //? Project\n 'publisher',\n 'name',\n 'displayName',\n 'version',\n 'description',\n 'private',\n 'publishConfig',\n\n //? Repository\n 'repository',\n 'bugs',\n 'homepage',\n 'funding',\n\n //? Author & license\n 'contributors',\n 'author',\n 'license',\n\n //? https://code.visualstudio.com/api/references/extension-manifest\n 'keywords',\n 'categories',\n\n //? CDN\n 'unpkg',\n 'jsdelivr',\n\n //? Export\n 'type', // module or commonjs\n 'main',\n 'types',\n 'typings', // synonymous with types\n 'typesVersions',\n 'exports',\n 'bin',\n 'files',\n 'workspaces',\n\n //? https://code.visualstudio.com/api/references/extension-manifest\n 'icon',\n 'activationEvents',\n 'contributes',\n\n //? Scripts\n 'scripts',\n\n //? Node & packageManager\n 'volta',\n 'engines',\n 'packageManager',\n\n //? Dependencies\n 'dependencies',\n 'devDependencies',\n 'peerDependencies',\n 'peerDependenciesMeta',\n 'bundleDependencies',\n 'optionalDependencies',\n\n 'pnpm',\n 'overrides',\n 'resolutions',\n\n //? Lib config\n 'husky',\n 'simple-git-hooks',\n 'lint-staged',\n 'eslintConfig',\n ];\n\n return configItem;\n },\n};\n"]}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkZIJ5OQW5_cjs = require('./chunk-ZIJ5OQW5.cjs');
|
|
4
|
+
var chunk4NIL3QOR_cjs = require('./chunk-4NIL3QOR.cjs');
|
|
5
|
+
var chunkTZB7IM2G_cjs = require('./chunk-TZB7IM2G.cjs');
|
|
6
|
+
var antfu = require('@antfu/eslint-config');
|
|
7
|
+
|
|
8
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
|
|
10
|
+
var antfu__default = /*#__PURE__*/_interopDefault(antfu);
|
|
11
|
+
|
|
12
|
+
function defineConfig(...[options = {}, ...userConfigs]) {
|
|
13
|
+
return antfu__default.default(
|
|
14
|
+
{
|
|
15
|
+
isInEditor: false,
|
|
16
|
+
stylistic: false,
|
|
17
|
+
formatters: false,
|
|
18
|
+
...options
|
|
19
|
+
},
|
|
20
|
+
chunkTZB7IM2G_cjs.unicornFilenameCase,
|
|
21
|
+
...userConfigs
|
|
22
|
+
).override(...chunk4NIL3QOR_cjs.defineOverride(chunkZIJ5OQW5_cjs.sortPackageJson));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
module.exports = defineConfig;
|
|
26
|
+
//# sourceMappingURL=out.js.map
|
|
27
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,WAAW;AAKH,SAAR,gBACF,CAAC,UAAU,CAAC,GAAG,GAAG,WAAW,GAChC;AACA,SAAO;AAAA,IACL;AAAA,MACE,YAAY;AAAA,MACZ,WAAW;AAAA,MACX,YAAY;AAAA,MACZ,GAAG;AAAA,IACL;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,EAAE,SAAS,GAAG,eAAe,eAAe,CAAC;AAC/C","sourcesContent":["import antfu from '@antfu/eslint-config';\nimport { sortPackageJson } from './overrides/sort-package-json';\nimport { unicornFilenameCase } from './rules/unicorn-filename-case';\nimport { defineOverride } from './overrides/types';\n\nexport default function defineConfig(\n ...[options = {}, ...userConfigs]: Parameters<typeof antfu>\n) {\n return antfu(\n {\n isInEditor: false,\n stylistic: false,\n formatters: false,\n ...options,\n },\n unicornFilenameCase,\n ...userConfigs,\n ).override(...defineOverride(sortPackageJson));\n}\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as _store_eslint_flat_config_utils_npm_0_2_5_cf879f1193_package from '.store/eslint-flat-config-utils-npm-0.2.5-cf879f1193/package';
|
|
2
|
+
import * as _antfu_eslint_config from '@antfu/eslint-config';
|
|
3
|
+
import _antfu_eslint_config__default from '@antfu/eslint-config';
|
|
4
|
+
|
|
5
|
+
declare function defineConfig(...[options, ...userConfigs]: Parameters<typeof _antfu_eslint_config__default>): _store_eslint_flat_config_utils_npm_0_2_5_cf879f1193_package.FlatConfigComposer<_antfu_eslint_config.TypedFlatConfigItem, _antfu_eslint_config.ConfigNames>;
|
|
6
|
+
|
|
7
|
+
export { defineConfig as default };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as _store_eslint_flat_config_utils_npm_0_2_5_cf879f1193_package from '.store/eslint-flat-config-utils-npm-0.2.5-cf879f1193/package';
|
|
2
|
+
import * as _antfu_eslint_config from '@antfu/eslint-config';
|
|
3
|
+
import _antfu_eslint_config__default from '@antfu/eslint-config';
|
|
4
|
+
|
|
5
|
+
declare function defineConfig(...[options, ...userConfigs]: Parameters<typeof _antfu_eslint_config__default>): _store_eslint_flat_config_utils_npm_0_2_5_cf879f1193_package.FlatConfigComposer<_antfu_eslint_config.TypedFlatConfigItem, _antfu_eslint_config.ConfigNames>;
|
|
6
|
+
|
|
7
|
+
export { defineConfig as default };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { sortPackageJson } from './chunk-N7KES6RB.js';
|
|
2
|
+
import { defineOverride } from './chunk-WJDZNLOH.js';
|
|
3
|
+
import { unicornFilenameCase } from './chunk-QYDW5TS2.js';
|
|
4
|
+
import antfu from '@antfu/eslint-config';
|
|
5
|
+
|
|
6
|
+
function defineConfig(...[options = {}, ...userConfigs]) {
|
|
7
|
+
return antfu(
|
|
8
|
+
{
|
|
9
|
+
isInEditor: false,
|
|
10
|
+
stylistic: false,
|
|
11
|
+
formatters: false,
|
|
12
|
+
...options
|
|
13
|
+
},
|
|
14
|
+
unicornFilenameCase,
|
|
15
|
+
...userConfigs
|
|
16
|
+
).override(...defineOverride(sortPackageJson));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { defineConfig as default };
|
|
20
|
+
//# sourceMappingURL=out.js.map
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,WAAW;AAKH,SAAR,gBACF,CAAC,UAAU,CAAC,GAAG,GAAG,WAAW,GAChC;AACA,SAAO;AAAA,IACL;AAAA,MACE,YAAY;AAAA,MACZ,WAAW;AAAA,MACX,YAAY;AAAA,MACZ,GAAG;AAAA,IACL;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,EAAE,SAAS,GAAG,eAAe,eAAe,CAAC;AAC/C","sourcesContent":["import antfu from '@antfu/eslint-config';\nimport { sortPackageJson } from './overrides/sort-package-json';\nimport { unicornFilenameCase } from './rules/unicorn-filename-case';\nimport { defineOverride } from './overrides/types';\n\nexport default function defineConfig(\n ...[options = {}, ...userConfigs]: Parameters<typeof antfu>\n) {\n return antfu(\n {\n isInEditor: false,\n stylistic: false,\n formatters: false,\n ...options,\n },\n unicornFilenameCase,\n ...userConfigs,\n ).override(...defineOverride(sortPackageJson));\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkZIJ5OQW5_cjs = require('../chunk-ZIJ5OQW5.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "sortPackageJson", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunkZIJ5OQW5_cjs.sortPackageJson; }
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=out.js.map
|
|
12
|
+
//# sourceMappingURL=sort-package-json.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk4NIL3QOR_cjs = require('../chunk-4NIL3QOR.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "defineOverride", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunk4NIL3QOR_cjs.defineOverride; }
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=out.js.map
|
|
12
|
+
//# sourceMappingURL=types.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TypedFlatConfigItem, Awaitable } from '@antfu/eslint-config';
|
|
2
|
+
|
|
3
|
+
interface OverrideConfig {
|
|
4
|
+
name: NonNullable<TypedFlatConfigItem['name']>;
|
|
5
|
+
config: TypedFlatConfigItem | (() => Awaitable<TypedFlatConfigItem>);
|
|
6
|
+
}
|
|
7
|
+
declare const defineOverride: ({ name, config }: OverrideConfig) => readonly [string, TypedFlatConfigItem | (() => Awaitable<TypedFlatConfigItem>)];
|
|
8
|
+
|
|
9
|
+
export { type OverrideConfig, defineOverride };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TypedFlatConfigItem, Awaitable } from '@antfu/eslint-config';
|
|
2
|
+
|
|
3
|
+
interface OverrideConfig {
|
|
4
|
+
name: NonNullable<TypedFlatConfigItem['name']>;
|
|
5
|
+
config: TypedFlatConfigItem | (() => Awaitable<TypedFlatConfigItem>);
|
|
6
|
+
}
|
|
7
|
+
declare const defineOverride: ({ name, config }: OverrideConfig) => readonly [string, TypedFlatConfigItem | (() => Awaitable<TypedFlatConfigItem>)];
|
|
8
|
+
|
|
9
|
+
export { type OverrideConfig, defineOverride };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkTZB7IM2G_cjs = require('../chunk-TZB7IM2G.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "unicornFilenameCase", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunkTZB7IM2G_cjs.unicornFilenameCase; }
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=out.js.map
|
|
12
|
+
//# sourceMappingURL=unicorn-filename-case.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@culur/config-eslint",
|
|
3
|
+
"version": "0.0.0-dev-20240527064403",
|
|
4
|
+
"description": "Culur's eslint configuration",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/culur/culur.git",
|
|
11
|
+
"directory": "packages/config-eslint"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/culur/culur/issues"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://github.com/culur/culur#readme",
|
|
17
|
+
"author": "culur <culur.net@gmail.com>",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"keywords": [
|
|
20
|
+
"culur",
|
|
21
|
+
"config",
|
|
22
|
+
"eslint"
|
|
23
|
+
],
|
|
24
|
+
"type": "module",
|
|
25
|
+
"main": "./dist/index.js",
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"import": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"default": "./dist/index.js"
|
|
32
|
+
},
|
|
33
|
+
"require": {
|
|
34
|
+
"types": "./dist/index.d.cts",
|
|
35
|
+
"default": "./dist/index.cjs"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
".eslintignore",
|
|
41
|
+
".eslintrc.cjs",
|
|
42
|
+
"CHANGELOG.md",
|
|
43
|
+
"LICENSE",
|
|
44
|
+
"README.md",
|
|
45
|
+
"dist",
|
|
46
|
+
"src"
|
|
47
|
+
],
|
|
48
|
+
"scripts": {
|
|
49
|
+
"clean": "rimraf dist",
|
|
50
|
+
"build": "tsup",
|
|
51
|
+
"test": "tsc --noEmit && vitest run"
|
|
52
|
+
},
|
|
53
|
+
"volta": {
|
|
54
|
+
"extends": "../../package.json"
|
|
55
|
+
},
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": ">=20"
|
|
58
|
+
},
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"@antfu/eslint-config": "^2.18.1"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@culur/config-tsup": "workspace:*",
|
|
64
|
+
"@culur/config-typescript": "workspace:*",
|
|
65
|
+
"@culur/config-vite": "workspace:*",
|
|
66
|
+
"@eslint/eslintrc": "^3.1.0",
|
|
67
|
+
"@types/eslint": "^8.56.10",
|
|
68
|
+
"@types/node": "^20.12.12",
|
|
69
|
+
"@vitest/coverage-v8": "^1.6.0",
|
|
70
|
+
"@vitest/ui": "^1.6.0",
|
|
71
|
+
"eslint": "^9.3.0",
|
|
72
|
+
"rimraf": "^5.0.7",
|
|
73
|
+
"tsup": "^8.0.2",
|
|
74
|
+
"type-fest": "^4.18.3",
|
|
75
|
+
"typescript": "^5.4.5",
|
|
76
|
+
"vitest": "^1.6.0"
|
|
77
|
+
},
|
|
78
|
+
"peerDependencies": {
|
|
79
|
+
"eslint": ">=9.2.0"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type antfu from '@antfu/eslint-config';
|
|
2
|
+
import { expectTypeOf, it } from 'vitest';
|
|
3
|
+
import defineConfig from '.';
|
|
4
|
+
|
|
5
|
+
it('should be valid', () => {
|
|
6
|
+
const config = defineConfig();
|
|
7
|
+
|
|
8
|
+
expectTypeOf(config).toEqualTypeOf<ReturnType<typeof antfu>>();
|
|
9
|
+
expectTypeOf(defineConfig).toEqualTypeOf<typeof antfu>();
|
|
10
|
+
});
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import antfu from '@antfu/eslint-config';
|
|
2
|
+
import { sortPackageJson } from './overrides/sort-package-json';
|
|
3
|
+
import { unicornFilenameCase } from './rules/unicorn-filename-case';
|
|
4
|
+
import { defineOverride } from './overrides/types';
|
|
5
|
+
|
|
6
|
+
export default function defineConfig(
|
|
7
|
+
...[options = {}, ...userConfigs]: Parameters<typeof antfu>
|
|
8
|
+
) {
|
|
9
|
+
return antfu(
|
|
10
|
+
{
|
|
11
|
+
isInEditor: false,
|
|
12
|
+
stylistic: false,
|
|
13
|
+
formatters: false,
|
|
14
|
+
...options,
|
|
15
|
+
},
|
|
16
|
+
unicornFilenameCase,
|
|
17
|
+
...userConfigs,
|
|
18
|
+
).override(...defineOverride(sortPackageJson));
|
|
19
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { sortPackageJson as sortPackageJsonAntfuFunction } from '@antfu/eslint-config';
|
|
2
|
+
import { assert, it } from 'vitest';
|
|
3
|
+
import { sortPackageJson as sortPackageJsonLocalOverride } from './sort-package-json';
|
|
4
|
+
|
|
5
|
+
it('should be valid rule', async () => {
|
|
6
|
+
const [sortPackageJsonAntfu] = await sortPackageJsonAntfuFunction();
|
|
7
|
+
|
|
8
|
+
const sortPackageJsonLocal =
|
|
9
|
+
typeof sortPackageJsonLocalOverride.config === 'function'
|
|
10
|
+
? await sortPackageJsonLocalOverride.config()
|
|
11
|
+
: sortPackageJsonLocalOverride.config;
|
|
12
|
+
|
|
13
|
+
assert(sortPackageJsonLocal.rules);
|
|
14
|
+
assert(sortPackageJsonAntfu.rules);
|
|
15
|
+
|
|
16
|
+
assert.deepEqual(
|
|
17
|
+
sortPackageJsonLocal.rules['jsonc/sort-array-values'],
|
|
18
|
+
sortPackageJsonAntfu.rules['jsonc/sort-array-values'],
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
assert.containsAllKeys(
|
|
22
|
+
sortPackageJsonLocal.rules,
|
|
23
|
+
Object.keys(sortPackageJsonAntfu.rules),
|
|
24
|
+
);
|
|
25
|
+
});
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import assert from 'node:assert';
|
|
2
|
+
import { sortPackageJson as sortPackageJsonAntfu } from '@antfu/eslint-config';
|
|
3
|
+
import type { OverrideConfig } from './types';
|
|
4
|
+
|
|
5
|
+
export const sortPackageJson: OverrideConfig = {
|
|
6
|
+
name: 'antfu/sort/package-json',
|
|
7
|
+
async config() {
|
|
8
|
+
const [configItem] = await sortPackageJsonAntfu();
|
|
9
|
+
assert(typeof configItem.name === 'string');
|
|
10
|
+
assert(typeof configItem.rules === 'object');
|
|
11
|
+
|
|
12
|
+
const sortKeys = configItem.rules['jsonc/sort-keys'];
|
|
13
|
+
assert(typeof sortKeys === 'object');
|
|
14
|
+
|
|
15
|
+
const [, options] = sortKeys;
|
|
16
|
+
assert(typeof options === 'object');
|
|
17
|
+
|
|
18
|
+
options.order = [
|
|
19
|
+
//? Project
|
|
20
|
+
'publisher',
|
|
21
|
+
'name',
|
|
22
|
+
'displayName',
|
|
23
|
+
'version',
|
|
24
|
+
'description',
|
|
25
|
+
'private',
|
|
26
|
+
'publishConfig',
|
|
27
|
+
|
|
28
|
+
//? Repository
|
|
29
|
+
'repository',
|
|
30
|
+
'bugs',
|
|
31
|
+
'homepage',
|
|
32
|
+
'funding',
|
|
33
|
+
|
|
34
|
+
//? Author & license
|
|
35
|
+
'contributors',
|
|
36
|
+
'author',
|
|
37
|
+
'license',
|
|
38
|
+
|
|
39
|
+
//? https://code.visualstudio.com/api/references/extension-manifest
|
|
40
|
+
'keywords',
|
|
41
|
+
'categories',
|
|
42
|
+
|
|
43
|
+
//? CDN
|
|
44
|
+
'unpkg',
|
|
45
|
+
'jsdelivr',
|
|
46
|
+
|
|
47
|
+
//? Export
|
|
48
|
+
'type', // module or commonjs
|
|
49
|
+
'main',
|
|
50
|
+
'types',
|
|
51
|
+
'typings', // synonymous with types
|
|
52
|
+
'typesVersions',
|
|
53
|
+
'exports',
|
|
54
|
+
'bin',
|
|
55
|
+
'files',
|
|
56
|
+
'workspaces',
|
|
57
|
+
|
|
58
|
+
//? https://code.visualstudio.com/api/references/extension-manifest
|
|
59
|
+
'icon',
|
|
60
|
+
'activationEvents',
|
|
61
|
+
'contributes',
|
|
62
|
+
|
|
63
|
+
//? Scripts
|
|
64
|
+
'scripts',
|
|
65
|
+
|
|
66
|
+
//? Node & packageManager
|
|
67
|
+
'volta',
|
|
68
|
+
'engines',
|
|
69
|
+
'packageManager',
|
|
70
|
+
|
|
71
|
+
//? Dependencies
|
|
72
|
+
'dependencies',
|
|
73
|
+
'devDependencies',
|
|
74
|
+
'peerDependencies',
|
|
75
|
+
'peerDependenciesMeta',
|
|
76
|
+
'bundleDependencies',
|
|
77
|
+
'optionalDependencies',
|
|
78
|
+
|
|
79
|
+
'pnpm',
|
|
80
|
+
'overrides',
|
|
81
|
+
'resolutions',
|
|
82
|
+
|
|
83
|
+
//? Lib config
|
|
84
|
+
'husky',
|
|
85
|
+
'simple-git-hooks',
|
|
86
|
+
'lint-staged',
|
|
87
|
+
'eslintConfig',
|
|
88
|
+
];
|
|
89
|
+
|
|
90
|
+
return configItem;
|
|
91
|
+
},
|
|
92
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Awaitable } from 'vitest';
|
|
2
|
+
import { expect, expectTypeOf, it } from 'vitest';
|
|
3
|
+
import type { TypedFlatConfigItem } from '@antfu/eslint-config';
|
|
4
|
+
import type { OverrideConfig } from './types';
|
|
5
|
+
import { defineOverride } from './types';
|
|
6
|
+
|
|
7
|
+
it.each<OverrideConfig>([
|
|
8
|
+
{
|
|
9
|
+
name: 'object',
|
|
10
|
+
config: { rules: {} },
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: 'function',
|
|
14
|
+
config: () => ({ rules: {} }),
|
|
15
|
+
},
|
|
16
|
+
])('config is $name', options => {
|
|
17
|
+
const overrideParameter = defineOverride(options);
|
|
18
|
+
|
|
19
|
+
const [name, config] = overrideParameter;
|
|
20
|
+
|
|
21
|
+
expect(typeof name).toEqual('string');
|
|
22
|
+
expectTypeOf(config).toMatchTypeOf<
|
|
23
|
+
TypedFlatConfigItem | (() => Awaitable<TypedFlatConfigItem>)
|
|
24
|
+
>();
|
|
25
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Awaitable, TypedFlatConfigItem } from '@antfu/eslint-config';
|
|
2
|
+
|
|
3
|
+
export interface OverrideConfig {
|
|
4
|
+
name: NonNullable<TypedFlatConfigItem['name']>;
|
|
5
|
+
config: TypedFlatConfigItem | (() => Awaitable<TypedFlatConfigItem>);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const defineOverride = ({ name, config }: OverrideConfig) =>
|
|
9
|
+
[name, config] as const;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { expectTypeOf, it } from 'vitest';
|
|
2
|
+
import type { TypedFlatConfigItem } from '@antfu/eslint-config';
|
|
3
|
+
import { unicornFilenameCase } from './unicorn-filename-case';
|
|
4
|
+
|
|
5
|
+
it('should be valid rule', async () => {
|
|
6
|
+
expectTypeOf(unicornFilenameCase).toEqualTypeOf<TypedFlatConfigItem>();
|
|
7
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TypedFlatConfigItem } from '@antfu/eslint-config';
|
|
2
|
+
|
|
3
|
+
export const unicornFilenameCase: TypedFlatConfigItem = {
|
|
4
|
+
files: ['**/*.ts', '**/*.js'],
|
|
5
|
+
rules: {
|
|
6
|
+
'unicorn/filename-case': [
|
|
7
|
+
'error',
|
|
8
|
+
{
|
|
9
|
+
case: 'kebabCase',
|
|
10
|
+
ignore: ['README.md'],
|
|
11
|
+
},
|
|
12
|
+
],
|
|
13
|
+
},
|
|
14
|
+
};
|