Skip to content

Commit ca57ab4

Browse files
feat: plugin and rule to sort package.json properties
1 parent 8272ec4 commit ca57ab4

File tree

11 files changed

+470
-31
lines changed

11 files changed

+470
-31
lines changed

configs.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ configs.recommended = [
295295
jestConfig,
296296
configs["markdown/recommended"],
297297
configs["stylistic/recommended"],
298+
configs["package-json/recommended"],
298299
];
299300

300301
configs["recommended-module"] = [
@@ -306,6 +307,7 @@ configs["recommended-module"] = [
306307
jestConfig,
307308
configs["markdown/recommended"],
308309
configs["stylistic/recommended"],
310+
configs["package-json/recommended"],
309311
];
310312

311313
configs["recommended-commonjs"] = [
@@ -317,6 +319,7 @@ configs["recommended-commonjs"] = [
317319
jestConfig,
318320
configs["markdown/recommended"],
319321
configs["stylistic/recommended"],
322+
configs["package-json/recommended"],
320323
];
321324

322325
configs["recommended-dirty"] = [
@@ -328,6 +331,7 @@ configs["recommended-dirty"] = [
328331
jestConfig,
329332
configs["markdown/recommended"],
330333
configs["stylistic/recommended"],
334+
configs["package-json/recommended"],
331335
];
332336

333337
export { default } from "./configs/index.js";

configs/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import markdownConfig from "./markdown.js";
55
import nodeConfig from "./node.js";
66
import stylisticConfig from "./stylistic.js";
77
import typescriptConfig from "./typescript.js";
8+
import packageJSON from "./package-json.js";
89

910
const configs = {
1011
...browserConfig,
@@ -14,6 +15,7 @@ const configs = {
1415
...nodeConfig,
1516
...stylisticConfig,
1617
...typescriptConfig,
18+
...packageJSON,
1719
};
1820

1921
export default configs;

configs/package-json.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { configs } from "../plugins/package-json/index.js";
2+
3+
const recommendedBrowserConfig = {
4+
...configs.recommended,
5+
};
6+
7+
export default {
8+
"package-json/recommended": recommendedBrowserConfig,
9+
};

package-lock.json

Lines changed: 167 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,30 @@
11
{
22
"name": "eslint-config-webpack",
33
"version": "4.1.4",
4-
"author": "Joshua Wiens (https://twitter.com/@d3viant0ne)",
5-
"license": "MIT",
64
"description": "Provides Webpack's eslint rules as an extensible shared config",
5+
"keywords": [
6+
"eslint",
7+
"eslintconfig",
8+
"config",
9+
"webpack",
10+
"javascript",
11+
"typescript"
12+
],
13+
"homepage": "https://github.com/webpack/eslint-config-webpack#readme",
14+
"bugs": {
15+
"url": "https://github.com/webpack/eslint-config-webpack/issues"
16+
},
17+
"repository": {
18+
"type": "git",
19+
"url": "git+https://github.com/webpack/eslint-config-webpack.git"
20+
},
21+
"license": "MIT",
22+
"author": "Joshua Wiens (https://twitter.com/@d3viant0ne)",
723
"type": "module",
824
"main": "index.js",
925
"files": [
1026
"index.js",
27+
"plugins",
1128
"prettier-config.js",
1229
"prettier-config-es5.js",
1330
"configs.js",
@@ -16,11 +33,14 @@
1633
],
1734
"scripts": {
1835
"lint": "npm run lint:code",
19-
"lint:code": "node node_modules/eslint/bin/eslint.js --cache .",
36+
"lint:code": "eslint --cache .",
2037
"release": "standard-version"
2138
},
2239
"dependencies": {
23-
"semver": "^7.7.2"
40+
"detect-indent": "^7.0.1",
41+
"jsonc-eslint-parser": "^2.4.0",
42+
"semver": "^7.7.2",
43+
"sort-package-json": "^3.3.1"
2444
},
2545
"devDependencies": {
2646
"@eslint/js": "^9.29.0",
@@ -80,20 +100,5 @@
80100
},
81101
"engines": {
82102
"node": ">= 18.20.0"
83-
},
84-
"repository": {
85-
"type": "git",
86-
"url": "git+https://github.com/webpack/eslint-config-webpack.git"
87-
},
88-
"keywords": [
89-
"eslint",
90-
"eslintconfig",
91-
"config",
92-
"webpack",
93-
"javascirpt"
94-
],
95-
"bugs": {
96-
"url": "https://github.com/webpack/eslint-config-webpack/issues"
97-
},
98-
"homepage": "https://github.com/webpack/eslint-config-webpack#readme"
103+
}
99104
}

0 commit comments

Comments
 (0)