@kazupon/eslint-config 0.9.0 → 0.9.1

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.
Files changed (3) hide show
  1. package/dist/index.cjs +24 -11
  2. package/dist/index.js +24 -11
  3. package/package.json +26 -22
package/dist/index.cjs CHANGED
@@ -221,12 +221,6 @@ async function jsonc(options = {}) {
221
221
  const usePrettier = !!options.prettier;
222
222
  const jsonc$1 = await loadPlugin('eslint-plugin-jsonc');
223
223
  const configs = [];
224
- const defaultRules = {'jsonc/sort-keys': ['warn', 'asc', {
225
- caseSensitive: true,
226
- natural: false,
227
- minKeys: 2,
228
- allowLineSeparatedGroups: false
229
- }]};
230
224
  for (const kind of kinds) {
231
225
  if (kind) {
232
226
  configs.push(...jsonc$1.configs[`flat/recommended-with-${kind}`].map((config, index) => {
@@ -248,14 +242,33 @@ async function jsonc(options = {}) {
248
242
  const overriddenConfig = {
249
243
  name: '@kazupon/jsonc',
250
244
  files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
251
- rules: {
252
- ...defaultRules,
253
- ...overrideRules
254
- }
245
+ rules: {...overrideRules}
255
246
  };
256
- configs.push(overriddenConfig);
247
+ configs.push(...jsoncSort(), overriddenConfig);
257
248
  return configs;
258
249
  }
250
+ function jsoncSort() {
251
+ return [{
252
+ name: '@kazupon/jsonc/sort/package.json',
253
+ files: ['**/package.json'],
254
+ rules: {
255
+ 'jsonc/sort-array-values': ['error', {
256
+ order: {type: 'asc'},
257
+ pathPattern: '^files$'
258
+ }],
259
+ 'jsonc/sort-keys': ['error', {
260
+ order: ['name', 'description', 'private', 'version', 'author', 'contributors', 'license', 'funding', 'bugs', 'repository', 'keywords', 'homepage', 'publishConfig', 'packageManager', 'engines', 'os', 'cpu', 'type', 'main', 'module', 'browser', 'unpkg', 'jsdelivr', 'sideEffects', 'bin', 'files', 'directories', 'exports', 'types', 'typesVersions', 'scripts', 'dependencies', 'peerDependencies', 'peerDependenciesMeta', 'optionalDependencies', 'devDependencies', 'pnpm', 'overrides', 'resolutions', 'workspaces', 'prettier', 'buildOPtions', 'lint-staged'],
261
+ pathPattern: '^$'
262
+ }, {
263
+ order: {type: 'asc'},
264
+ pathPattern: '^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$'
265
+ }, {
266
+ order: {type: 'asc'},
267
+ pathPattern: '^(?:resolutions|overrides|pnpm.overrides)$'
268
+ }]
269
+ }
270
+ }];
271
+ }
259
272
 
260
273
  //#endregion
261
274
  //#region src/configs/yml.ts
package/dist/index.js CHANGED
@@ -196,12 +196,6 @@ async function jsonc(options = {}) {
196
196
  const usePrettier = !!options.prettier;
197
197
  const jsonc$1 = await loadPlugin('eslint-plugin-jsonc');
198
198
  const configs = [];
199
- const defaultRules = {'jsonc/sort-keys': ['warn', 'asc', {
200
- caseSensitive: true,
201
- natural: false,
202
- minKeys: 2,
203
- allowLineSeparatedGroups: false
204
- }]};
205
199
  for (const kind of kinds) {
206
200
  if (kind) {
207
201
  configs.push(...jsonc$1.configs[`flat/recommended-with-${kind}`].map((config, index) => {
@@ -223,14 +217,33 @@ async function jsonc(options = {}) {
223
217
  const overriddenConfig = {
224
218
  name: '@kazupon/jsonc',
225
219
  files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
226
- rules: {
227
- ...defaultRules,
228
- ...overrideRules
229
- }
220
+ rules: {...overrideRules}
230
221
  };
231
- configs.push(overriddenConfig);
222
+ configs.push(...jsoncSort(), overriddenConfig);
232
223
  return configs;
233
224
  }
225
+ function jsoncSort() {
226
+ return [{
227
+ name: '@kazupon/jsonc/sort/package.json',
228
+ files: ['**/package.json'],
229
+ rules: {
230
+ 'jsonc/sort-array-values': ['error', {
231
+ order: {type: 'asc'},
232
+ pathPattern: '^files$'
233
+ }],
234
+ 'jsonc/sort-keys': ['error', {
235
+ order: ['name', 'description', 'private', 'version', 'author', 'contributors', 'license', 'funding', 'bugs', 'repository', 'keywords', 'homepage', 'publishConfig', 'packageManager', 'engines', 'os', 'cpu', 'type', 'main', 'module', 'browser', 'unpkg', 'jsdelivr', 'sideEffects', 'bin', 'files', 'directories', 'exports', 'types', 'typesVersions', 'scripts', 'dependencies', 'peerDependencies', 'peerDependenciesMeta', 'optionalDependencies', 'devDependencies', 'pnpm', 'overrides', 'resolutions', 'workspaces', 'prettier', 'buildOPtions', 'lint-staged'],
236
+ pathPattern: '^$'
237
+ }, {
238
+ order: {type: 'asc'},
239
+ pathPattern: '^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$'
240
+ }, {
241
+ order: {type: 'asc'},
242
+ pathPattern: '^(?:resolutions|overrides|pnpm.overrides)$'
243
+ }]
244
+ }
245
+ }];
246
+ }
234
247
 
235
248
  //#endregion
236
249
  //#region src/configs/yml.ts
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@kazupon/eslint-config",
3
- "version": "0.9.0",
4
3
  "description": "ESLint config for @kazupon",
5
- "keywords": [
6
- "config",
7
- "eslint"
8
- ],
4
+ "version": "0.9.1",
5
+ "author": {
6
+ "email": "kawakazu80@gmail.com",
7
+ "name": "kazuya kawaguchi"
8
+ },
9
9
  "license": "MIT",
10
10
  "funding": "https://github.com/sponsors/kazupon",
11
11
  "bugs": {
@@ -15,6 +15,10 @@
15
15
  "type": "git",
16
16
  "url": "git+https://github.com/kazupon/eslint-config.git"
17
17
  },
18
+ "keywords": [
19
+ "config",
20
+ "eslint"
21
+ ],
18
22
  "homepage": "https://github.com/kazupon/eslint-config#readme",
19
23
  "publishConfig": {
20
24
  "access": "public"
@@ -25,7 +29,6 @@
25
29
  "type": "module",
26
30
  "main": "./dist/index.cjs",
27
31
  "module": "./dist/index.js",
28
- "types": "./dist/index.d.ts",
29
32
  "files": [
30
33
  "dist"
31
34
  ],
@@ -35,6 +38,7 @@
35
38
  "require": "./dist/index.cjs"
36
39
  }
37
40
  },
41
+ "types": "./dist/index.d.ts",
38
42
  "dependencies": {
39
43
  "@eslint-community/eslint-plugin-eslint-comments": "^4.3.0",
40
44
  "@eslint/js": "^9.0.0",
@@ -107,34 +111,34 @@
107
111
  "typescript-eslint": "^7.15.0",
108
112
  "vitest": "^2.0.0"
109
113
  },
114
+ "prettier": "@kazupon/prettier-config",
110
115
  "lint-staged": {
111
- "*.{json,jsonc,json5,md,yml,yaml}": [
112
- "prettier --write"
116
+ "*.ts?(x)": [
117
+ "prettier --parser=typescript --write",
118
+ "eslint --fix"
113
119
  ],
114
120
  "*.{js,mjs,cjs}": [
115
121
  "prettier --write",
116
122
  "eslint --fix"
117
123
  ],
118
- "*.ts?(x)": [
119
- "prettier --parser=typescript --write",
120
- "eslint --fix"
124
+ "*.{json,jsonc,json5,md,yml,yaml}": [
125
+ "prettier --write"
121
126
  ]
122
127
  },
123
- "prettier": "@kazupon/prettier-config",
124
128
  "scripts": {
129
+ "build": "tsdown",
130
+ "build:inspector": "pnpm build && pnpx @eslint/config-inspector build",
125
131
  "changelog": "gh-changelogen --repo=kazupon/eslint-config",
126
- "release": "bumpp --commit \"release: v%s\" --all --push --tag",
127
- "lint": "run-p \"lint:* {@}\" --",
128
- "lint:prettier": "prettier . --check",
129
- "lint:eslint": "eslint .",
132
+ "dev": "pnpx @eslint/config-inspector --config eslint.config.ts",
130
133
  "fix": "run-p \"fix:* {@}\" --",
131
- "fix:prettier": "prettier . --write",
132
134
  "fix:eslint": "eslint . --fix",
133
- "dev": "pnpx @eslint/config-inspector --config eslint.config.ts",
135
+ "fix:prettier": "prettier . --write",
136
+ "lint": "run-p \"lint:* {@}\" --",
137
+ "lint:eslint": "eslint .",
138
+ "lint:prettier": "prettier . --check",
139
+ "release": "bumpp --commit \"release: v%s\" --all --push --tag",
134
140
  "test": "vitest",
135
- "typegen": "pnpx tsx scripts/typegen.ts",
136
- "build": "tsdown",
137
- "build:inspector": "pnpm build && pnpx @eslint/config-inspector build",
138
- "typecheck": "tsc -p ."
141
+ "typecheck": "tsc -p .",
142
+ "typegen": "pnpx tsx scripts/typegen.ts"
139
143
  }
140
144
  }