@culur/config-eslint 0.0.0-dev-20240527064403 → 1.0.0
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 +7 -13
- package/README.md +76 -76
- package/dist/{chunk-N7KES6RB.js → chunk-5RDZUQTN.js} +1 -1
- package/dist/chunk-5RDZUQTN.js.map +1 -0
- package/dist/{chunk-WJDZNLOH.js → chunk-AZUQMYBV.js} +1 -1
- package/dist/chunk-AZUQMYBV.js.map +1 -0
- package/dist/{chunk-ZIJ5OQW5.cjs → chunk-EWC6UCP7.cjs} +1 -1
- package/dist/chunk-EWC6UCP7.cjs.map +1 -0
- package/dist/{chunk-4NIL3QOR.cjs → chunk-HD3NVFAB.cjs} +1 -1
- package/dist/chunk-HD3NVFAB.cjs.map +1 -0
- package/dist/{chunk-TZB7IM2G.cjs → chunk-V345HXXJ.cjs} +1 -1
- package/dist/{chunk-QYDW5TS2.js.map → chunk-V345HXXJ.cjs.map} +1 -1
- package/dist/{chunk-QYDW5TS2.js → chunk-YILOJM5L.js} +1 -1
- package/dist/{chunk-TZB7IM2G.cjs.map → chunk-YILOJM5L.js.map} +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/overrides/sort-package-json.cjs +2 -2
- package/dist/overrides/sort-package-json.js +1 -1
- package/dist/overrides/types.cjs +2 -2
- package/dist/overrides/types.js +1 -1
- package/dist/rules/unicorn-filename-case.cjs +2 -2
- package/dist/rules/unicorn-filename-case.js +1 -1
- package/package.json +4 -4
- package/src/index.test.ts +10 -10
- package/src/index.ts +19 -19
- package/src/overrides/sort-package-json.test.ts +25 -25
- package/src/overrides/sort-package-json.ts +92 -92
- package/src/overrides/types.test.ts +25 -25
- package/src/overrides/types.ts +9 -9
- package/src/rules/unicorn-filename-case.test.ts +7 -7
- package/src/rules/unicorn-filename-case.ts +14 -14
- package/dist/chunk-4NIL3QOR.cjs.map +0 -1
- package/dist/chunk-N7KES6RB.js.map +0 -1
- package/dist/chunk-WJDZNLOH.js.map +0 -1
- package/dist/chunk-ZIJ5OQW5.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
# @culur/config-eslint
|
|
2
|
-
|
|
3
|
-
##
|
|
4
|
-
|
|
5
|
-
###
|
|
6
|
-
|
|
7
|
-
- [
|
|
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
|
|
1
|
+
# @culur/config-eslint
|
|
2
|
+
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`210d07d`](https://github.com/culur/culur/commit/210d07d7ca6046807a2ff18011635c3b280dd707) Thanks [@phamhongphuc](https://github.com/phamhongphuc)! - First release
|
package/README.md
CHANGED
|
@@ -1,76 +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).
|
|
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/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';\r\nimport { sortPackageJson as sortPackageJsonAntfu } from '@antfu/eslint-config';\r\nimport type { OverrideConfig } from './types';\r\n\r\nexport const sortPackageJson: OverrideConfig = {\r\n name: 'antfu/sort/package-json',\r\n async config() {\r\n const [configItem] = await sortPackageJsonAntfu();\r\n assert(typeof configItem.name === 'string');\r\n assert(typeof configItem.rules === 'object');\r\n\r\n const sortKeys = configItem.rules['jsonc/sort-keys'];\r\n assert(typeof sortKeys === 'object');\r\n\r\n const [, options] = sortKeys;\r\n assert(typeof options === 'object');\r\n\r\n options.order = [\r\n //? Project\r\n 'publisher',\r\n 'name',\r\n 'displayName',\r\n 'version',\r\n 'description',\r\n 'private',\r\n 'publishConfig',\r\n\r\n //? Repository\r\n 'repository',\r\n 'bugs',\r\n 'homepage',\r\n 'funding',\r\n\r\n //? Author & license\r\n 'contributors',\r\n 'author',\r\n 'license',\r\n\r\n //? https://code.visualstudio.com/api/references/extension-manifest\r\n 'keywords',\r\n 'categories',\r\n\r\n //? CDN\r\n 'unpkg',\r\n 'jsdelivr',\r\n\r\n //? Export\r\n 'type', // module or commonjs\r\n 'main',\r\n 'types',\r\n 'typings', // synonymous with types\r\n 'typesVersions',\r\n 'exports',\r\n 'bin',\r\n 'files',\r\n 'workspaces',\r\n\r\n //? https://code.visualstudio.com/api/references/extension-manifest\r\n 'icon',\r\n 'activationEvents',\r\n 'contributes',\r\n\r\n //? Scripts\r\n 'scripts',\r\n\r\n //? Node & packageManager\r\n 'volta',\r\n 'engines',\r\n 'packageManager',\r\n\r\n //? Dependencies\r\n 'dependencies',\r\n 'devDependencies',\r\n 'peerDependencies',\r\n 'peerDependenciesMeta',\r\n 'bundleDependencies',\r\n 'optionalDependencies',\r\n\r\n 'pnpm',\r\n 'overrides',\r\n 'resolutions',\r\n\r\n //? Lib config\r\n 'husky',\r\n 'simple-git-hooks',\r\n 'lint-staged',\r\n 'eslintConfig',\r\n ];\r\n\r\n return configItem;\r\n },\r\n};\r\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';\r\n\r\nexport interface OverrideConfig {\r\n name: NonNullable<TypedFlatConfigItem['name']>;\r\n config: TypedFlatConfigItem | (() => Awaitable<TypedFlatConfigItem>);\r\n}\r\n\r\nexport const defineOverride = ({ name, config }: OverrideConfig) =>\r\n [name, config] as const;\r\n"]}
|
|
@@ -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';\r\nimport { sortPackageJson as sortPackageJsonAntfu } from '@antfu/eslint-config';\r\nimport type { OverrideConfig } from './types';\r\n\r\nexport const sortPackageJson: OverrideConfig = {\r\n name: 'antfu/sort/package-json',\r\n async config() {\r\n const [configItem] = await sortPackageJsonAntfu();\r\n assert(typeof configItem.name === 'string');\r\n assert(typeof configItem.rules === 'object');\r\n\r\n const sortKeys = configItem.rules['jsonc/sort-keys'];\r\n assert(typeof sortKeys === 'object');\r\n\r\n const [, options] = sortKeys;\r\n assert(typeof options === 'object');\r\n\r\n options.order = [\r\n //? Project\r\n 'publisher',\r\n 'name',\r\n 'displayName',\r\n 'version',\r\n 'description',\r\n 'private',\r\n 'publishConfig',\r\n\r\n //? Repository\r\n 'repository',\r\n 'bugs',\r\n 'homepage',\r\n 'funding',\r\n\r\n //? Author & license\r\n 'contributors',\r\n 'author',\r\n 'license',\r\n\r\n //? https://code.visualstudio.com/api/references/extension-manifest\r\n 'keywords',\r\n 'categories',\r\n\r\n //? CDN\r\n 'unpkg',\r\n 'jsdelivr',\r\n\r\n //? Export\r\n 'type', // module or commonjs\r\n 'main',\r\n 'types',\r\n 'typings', // synonymous with types\r\n 'typesVersions',\r\n 'exports',\r\n 'bin',\r\n 'files',\r\n 'workspaces',\r\n\r\n //? https://code.visualstudio.com/api/references/extension-manifest\r\n 'icon',\r\n 'activationEvents',\r\n 'contributes',\r\n\r\n //? Scripts\r\n 'scripts',\r\n\r\n //? Node & packageManager\r\n 'volta',\r\n 'engines',\r\n 'packageManager',\r\n\r\n //? Dependencies\r\n 'dependencies',\r\n 'devDependencies',\r\n 'peerDependencies',\r\n 'peerDependenciesMeta',\r\n 'bundleDependencies',\r\n 'optionalDependencies',\r\n\r\n 'pnpm',\r\n 'overrides',\r\n 'resolutions',\r\n\r\n //? Lib config\r\n 'husky',\r\n 'simple-git-hooks',\r\n 'lint-staged',\r\n 'eslintConfig',\r\n ];\r\n\r\n return configItem;\r\n },\r\n};\r\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';\r\n\r\nexport interface OverrideConfig {\r\n name: NonNullable<TypedFlatConfigItem['name']>;\r\n config: TypedFlatConfigItem | (() => Awaitable<TypedFlatConfigItem>);\r\n}\r\n\r\nexport const defineOverride = ({ name, config }: OverrideConfig) =>\r\n [name, config] as const;\r\n"]}
|
|
@@ -1 +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"]}
|
|
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';\r\n\r\nexport const unicornFilenameCase: TypedFlatConfigItem = {\r\n files: ['**/*.ts', '**/*.js'],\r\n rules: {\r\n 'unicorn/filename-case': [\r\n 'error',\r\n {\r\n case: 'kebabCase',\r\n ignore: ['README.md'],\r\n },\r\n ],\r\n },\r\n};\r\n"]}
|
|
@@ -1 +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"]}
|
|
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';\r\n\r\nexport const unicornFilenameCase: TypedFlatConfigItem = {\r\n files: ['**/*.ts', '**/*.js'],\r\n rules: {\r\n 'unicorn/filename-case': [\r\n 'error',\r\n {\r\n case: 'kebabCase',\r\n ignore: ['README.md'],\r\n },\r\n ],\r\n },\r\n};\r\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkEWC6UCP7_cjs = require('./chunk-EWC6UCP7.cjs');
|
|
4
|
+
var chunkHD3NVFAB_cjs = require('./chunk-HD3NVFAB.cjs');
|
|
5
|
+
var chunkV345HXXJ_cjs = require('./chunk-V345HXXJ.cjs');
|
|
6
6
|
var antfu = require('@antfu/eslint-config');
|
|
7
7
|
|
|
8
8
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -17,9 +17,9 @@ function defineConfig(...[options = {}, ...userConfigs]) {
|
|
|
17
17
|
formatters: false,
|
|
18
18
|
...options
|
|
19
19
|
},
|
|
20
|
-
|
|
20
|
+
chunkV345HXXJ_cjs.unicornFilenameCase,
|
|
21
21
|
...userConfigs
|
|
22
|
-
).override(...
|
|
22
|
+
).override(...chunkHD3NVFAB_cjs.defineOverride(chunkEWC6UCP7_cjs.sortPackageJson));
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
module.exports = defineConfig;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +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"]}
|
|
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';\r\nimport { sortPackageJson } from './overrides/sort-package-json';\r\nimport { unicornFilenameCase } from './rules/unicorn-filename-case';\r\nimport { defineOverride } from './overrides/types';\r\n\r\nexport default function defineConfig(\r\n ...[options = {}, ...userConfigs]: Parameters<typeof antfu>\r\n) {\r\n return antfu(\r\n {\r\n isInEditor: false,\r\n stylistic: false,\r\n formatters: false,\r\n ...options,\r\n },\r\n unicornFilenameCase,\r\n ...userConfigs,\r\n ).override(...defineOverride(sortPackageJson));\r\n}\r\n"]}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { sortPackageJson } from './chunk-
|
|
2
|
-
import { defineOverride } from './chunk-
|
|
3
|
-
import { unicornFilenameCase } from './chunk-
|
|
1
|
+
import { sortPackageJson } from './chunk-5RDZUQTN.js';
|
|
2
|
+
import { defineOverride } from './chunk-AZUQMYBV.js';
|
|
3
|
+
import { unicornFilenameCase } from './chunk-YILOJM5L.js';
|
|
4
4
|
import antfu from '@antfu/eslint-config';
|
|
5
5
|
|
|
6
6
|
function defineConfig(...[options = {}, ...userConfigs]) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +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"]}
|
|
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';\r\nimport { sortPackageJson } from './overrides/sort-package-json';\r\nimport { unicornFilenameCase } from './rules/unicorn-filename-case';\r\nimport { defineOverride } from './overrides/types';\r\n\r\nexport default function defineConfig(\r\n ...[options = {}, ...userConfigs]: Parameters<typeof antfu>\r\n) {\r\n return antfu(\r\n {\r\n isInEditor: false,\r\n stylistic: false,\r\n formatters: false,\r\n ...options,\r\n },\r\n unicornFilenameCase,\r\n ...userConfigs,\r\n ).override(...defineOverride(sortPackageJson));\r\n}\r\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkEWC6UCP7_cjs = require('../chunk-EWC6UCP7.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "sortPackageJson", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkEWC6UCP7_cjs.sortPackageJson; }
|
|
10
10
|
});
|
|
11
11
|
//# sourceMappingURL=out.js.map
|
|
12
12
|
//# sourceMappingURL=sort-package-json.cjs.map
|
package/dist/overrides/types.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkHD3NVFAB_cjs = require('../chunk-HD3NVFAB.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "defineOverride", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkHD3NVFAB_cjs.defineOverride; }
|
|
10
10
|
});
|
|
11
11
|
//# sourceMappingURL=out.js.map
|
|
12
12
|
//# sourceMappingURL=types.cjs.map
|
package/dist/overrides/types.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkV345HXXJ_cjs = require('../chunk-V345HXXJ.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "unicornFilenameCase", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkV345HXXJ_cjs.unicornFilenameCase; }
|
|
10
10
|
});
|
|
11
11
|
//# sourceMappingURL=out.js.map
|
|
12
12
|
//# sourceMappingURL=unicorn-filename-case.cjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@culur/config-eslint",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Culur's eslint configuration",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
"@antfu/eslint-config": "^2.18.1"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@culur/config-tsup": "
|
|
64
|
-
"@culur/config-typescript": "
|
|
65
|
-
"@culur/config-vite": "
|
|
63
|
+
"@culur/config-tsup": "*",
|
|
64
|
+
"@culur/config-typescript": "*",
|
|
65
|
+
"@culur/config-vite": "*",
|
|
66
66
|
"@eslint/eslintrc": "^3.1.0",
|
|
67
67
|
"@types/eslint": "^8.56.10",
|
|
68
68
|
"@types/node": "^20.12.12",
|
package/src/index.test.ts
CHANGED
|
@@ -1,10 +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
|
-
});
|
|
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
CHANGED
|
@@ -1,19 +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
|
-
}
|
|
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
|
+
}
|
|
@@ -1,25 +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
|
-
});
|
|
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
|
+
});
|
|
@@ -1,92 +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
|
-
};
|
|
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
|
+
};
|
|
@@ -1,25 +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
|
-
});
|
|
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
|
+
});
|
package/src/overrides/types.ts
CHANGED
|
@@ -1,9 +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;
|
|
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;
|
|
@@ -1,7 +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
|
-
});
|
|
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
|
+
});
|
|
@@ -1,14 +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
|
-
};
|
|
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
|
+
};
|
|
@@ -1 +0,0 @@
|
|
|
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"]}
|
|
@@ -1 +0,0 @@
|
|
|
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"]}
|
|
@@ -1 +0,0 @@
|
|
|
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"]}
|
|
@@ -1 +0,0 @@
|
|
|
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"]}
|