@ntnyq/eslint-config 4.0.1 → 4.0.3

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.d.mts +290 -215
  2. package/dist/index.mjs +122 -45
  3. package/package.json +25 -24
package/dist/index.mjs CHANGED
@@ -53,7 +53,7 @@ import pluginDeMorgan from 'eslint-plugin-de-morgan';
53
53
  export { default as pluginDeMorgan } from 'eslint-plugin-de-morgan';
54
54
  import pluginNoOnlyTests from 'eslint-plugin-no-only-tests';
55
55
  export { default as pluginNoOnlyTests } from 'eslint-plugin-no-only-tests';
56
- import { createConfig } from 'eslint-plugin-github-action';
56
+ import pluginGitHubAction from 'eslint-plugin-github-action';
57
57
  export { default as pluginGitHubAction } from 'eslint-plugin-github-action';
58
58
  import pluginPerfectionist from 'eslint-plugin-perfectionist';
59
59
  export { default as pluginPerfectionist } from 'eslint-plugin-perfectionist';
@@ -72,25 +72,33 @@ import globals from 'globals';
72
72
  import createGitIgnoreConfig from 'eslint-config-flat-gitignore';
73
73
  import jsConfig from '@eslint/js';
74
74
 
75
- const parserPlain = {
76
- meta: {
77
- name: "plain-eslint-parser"
75
+ const name = "eslint-parser-plain";
76
+ const version = "0.1.1";
77
+
78
+ const parseForESLint = (code) => ({
79
+ ast: {
80
+ type: "Program",
81
+ loc: { start: 0, end: code.length },
82
+ range: [0, code.length],
83
+ body: [],
84
+ comments: [],
85
+ tokens: []
78
86
  },
79
- parseForESLint: (code) => ({
80
- ast: {
81
- body: [],
82
- comments: [],
83
- loc: { start: 0, end: code.length },
84
- range: [0, code.length],
85
- tokens: [],
86
- type: "Program"
87
- },
88
- scopeManager: null,
89
- services: { isPlain: true },
90
- visitorKeys: {
91
- Program: []
92
- }
93
- })
87
+ services: { isPlain: true },
88
+ scopeManager: null,
89
+ visitorKeys: {
90
+ Program: []
91
+ }
92
+ });
93
+ const meta = {
94
+ name: name,
95
+ version: version
96
+ };
97
+
98
+ const parserPlain = {
99
+ __proto__: null,
100
+ meta: meta,
101
+ parseForESLint: parseForESLint
94
102
  };
95
103
 
96
104
  const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
@@ -127,18 +135,23 @@ const GLOB_JSON = "**/*.json";
127
135
  const GLOB_JSON5 = "**/*.json5";
128
136
  const GLOB_JSONC = "**/*.jsonc";
129
137
  const GLOB_PACKAGE_JSON = "**/package.json";
138
+ const GLOB_JSON_SCHEMA = [
139
+ "**/*.schema.json",
140
+ "**/schemas/*.json"
141
+ ];
130
142
  const GLOB_TSCONFIG_JSON = [
131
143
  "**/tsconfig.json",
132
144
  "**/tsconfig.*.json"
133
145
  ];
146
+ const GLOB_YAML = "**/*.y?(a)ml";
147
+ const GLOB_PNPM_WORKSPACE_YAML = "**/pnpm-workspace.yaml";
134
148
  const GLOB_SVG = "**/*.svg";
135
149
  const GLOB_VUE = "**/*.vue";
136
- const GLOB_YAML = "**/*.y?(a)ml";
150
+ const GLOB_SVELTE = "**/*.svelte";
137
151
  const GLOB_TOML = "**/*.toml";
138
152
  const GLOB_HTML = "**/*.htm?(l)";
139
153
  const GLOB_ASTRO = "**/*.astro";
140
154
  const GLOB_ASTRO_TS = "**/*.astro/*.ts";
141
- const GLOB_SVELTE = "**/*.svelte";
142
155
  const GLOB_MARKDOWN = "**/*.md";
143
156
  const GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
144
157
  const GLOB_MARKDOWN_NESTED = `${GLOB_MARKDOWN}/*.md`;
@@ -618,11 +631,14 @@ const configNode = (options = {}) => [
618
631
  ];
619
632
 
620
633
  const configPnpm = (options = {}) => {
621
- const { files = [GLOB_PACKAGE_JSON] } = options;
634
+ const {
635
+ filesJson = [GLOB_PACKAGE_JSON],
636
+ filesYaml = [GLOB_PNPM_WORKSPACE_YAML]
637
+ } = options;
622
638
  return [
623
639
  {
624
- name: "ntnyq/pnpm",
625
- files,
640
+ name: "ntnyq/pnpm/package-json",
641
+ files: filesJson,
626
642
  plugins: {
627
643
  pnpm: pluginPnpm
628
644
  },
@@ -630,15 +646,31 @@ const configPnpm = (options = {}) => {
630
646
  parser: parserJsonc
631
647
  },
632
648
  rules: {
633
- "pnpm/enforce-catalog": [
649
+ "pnpm/json-enforce-catalog": [
634
650
  "error",
635
651
  {
636
652
  autofix: true
637
653
  }
638
654
  ],
639
- "pnpm/valid-catalog": "error",
655
+ "pnpm/json-valid-catalog": "error",
640
656
  // Overrides rules
641
- ...options.overrides
657
+ ...options.overridesJsonRules
658
+ }
659
+ },
660
+ {
661
+ name: "ntnyq/pnpm/pnpm-workspace-yaml",
662
+ files: filesYaml,
663
+ plugins: {
664
+ pnpm: pluginPnpm
665
+ },
666
+ languageOptions: {
667
+ parser: parserYaml
668
+ },
669
+ rules: {
670
+ "pnpm/yaml-no-duplicate-catalog-item": "error",
671
+ "pnpm/yaml-no-unused-catalog-item": "error",
672
+ // Overrides rules
673
+ ...options.overridesYamlRules
642
674
  }
643
675
  }
644
676
  ];
@@ -650,6 +682,7 @@ const configSort = (options = {}) => {
650
682
  additionalJsonFiles = [],
651
683
  additionalYamlFiles = [],
652
684
  i18nLocale: enableSortI18nLocale = true,
685
+ jsonSchema: enableSortJsonSchema = true,
653
686
  packageJson: enableSortPackageJson = true,
654
687
  pnpmWorkspace: enableSortPnpmWorkspace = true,
655
688
  tsconfig: enableSortTsconfig = true
@@ -657,7 +690,7 @@ const configSort = (options = {}) => {
657
690
  if (enableSortTsconfig) {
658
691
  configs.push({
659
692
  name: "ntnyq/sort/tsconfig",
660
- files: ["**/tsconfig.json", "**/tsconfig.*.json"],
693
+ files: [...GLOB_TSCONFIG_JSON],
661
694
  rules: {
662
695
  "jsonc/sort-keys": [
663
696
  "error",
@@ -801,7 +834,7 @@ const configSort = (options = {}) => {
801
834
  if (enableSortPackageJson) {
802
835
  configs.push({
803
836
  name: "ntnyq/sort/package-json",
804
- files: ["**/package.json"],
837
+ files: [GLOB_PACKAGE_JSON],
805
838
  rules: {
806
839
  "jsonc/sort-array-values": [
807
840
  "error",
@@ -1020,10 +1053,55 @@ const configSort = (options = {}) => {
1020
1053
  }
1021
1054
  );
1022
1055
  }
1056
+ if (enableSortJsonSchema) {
1057
+ configs.push({
1058
+ name: "ntnyq/sort/json-schema",
1059
+ files: [...GLOB_JSON_SCHEMA],
1060
+ rules: {
1061
+ "jsonc/sort-array-values": [
1062
+ "error",
1063
+ {
1064
+ order: { type: "asc" },
1065
+ pathPattern: "^(?:required)$"
1066
+ }
1067
+ ],
1068
+ "jsonc/sort-keys": [
1069
+ "error",
1070
+ {
1071
+ pathPattern: "^$",
1072
+ order: [
1073
+ // Meta
1074
+ "$schema",
1075
+ "$comment",
1076
+ "$id",
1077
+ "$ref",
1078
+ "title",
1079
+ "description",
1080
+ "type",
1081
+ "definitions",
1082
+ "properties",
1083
+ "required",
1084
+ "additionalProperties",
1085
+ // Unknown fields
1086
+ {
1087
+ order: {
1088
+ type: "asc"
1089
+ }
1090
+ }
1091
+ ]
1092
+ },
1093
+ {
1094
+ order: { type: "asc" },
1095
+ pathPattern: "^(?:definitions|properties)$"
1096
+ }
1097
+ ]
1098
+ }
1099
+ });
1100
+ }
1023
1101
  if (enableSortPnpmWorkspace) {
1024
1102
  configs.push({
1025
1103
  name: "ntnyq/sort/pnpm-workspace",
1026
- files: ["**/pnpm-workspace.yaml"],
1104
+ files: [GLOB_PNPM_WORKSPACE_YAML],
1027
1105
  rules: {
1028
1106
  "yml/sort-keys": [
1029
1107
  "error",
@@ -2356,6 +2434,7 @@ const configSpecials = (options = {}) => {
2356
2434
  "vue/define-emits-declaration": "off",
2357
2435
  "vue/html-button-has-type": "off",
2358
2436
  "vue/no-duplicate-attr-inheritance": "off",
2437
+ "vue/prefer-use-template-ref": "off",
2359
2438
  // Overrides rules
2360
2439
  ...shadcnOptions.overridesRules
2361
2440
  }
@@ -2859,24 +2938,27 @@ const configESLintPlugin = async (options = {}) => {
2859
2938
 
2860
2939
  const configGitHubAction = (options = {}) => {
2861
2940
  const {
2941
+ //
2862
2942
  files = [GLOB_GITHUB_ACTION],
2863
- rules = {},
2864
- overrides: overridesRules = {},
2865
- ...restOptions
2943
+ overrides: overridesRules = {}
2866
2944
  } = options;
2867
2945
  return [
2868
- createConfig({
2946
+ {
2869
2947
  name: "ntnyq/github-action",
2870
2948
  files,
2949
+ plugins: {
2950
+ "github-action": pluginGitHubAction
2951
+ },
2952
+ languageOptions: {
2953
+ parser: parserYaml
2954
+ },
2871
2955
  rules: {
2872
2956
  "github-action/no-invalid-key": "error",
2873
2957
  "github-action/prefer-file-extension": "error",
2874
2958
  "github-action/require-action-name": "error",
2875
- ...rules,
2876
2959
  ...overridesRules
2877
- },
2878
- ...restOptions
2879
- })
2960
+ }
2961
+ }
2880
2962
  ];
2881
2963
  };
2882
2964
 
@@ -3387,12 +3469,7 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3387
3469
  );
3388
3470
  }
3389
3471
  if (enablePnpm) {
3390
- configs.push(
3391
- configPnpm({
3392
- ...resolveSubOptions(options, "pnpm"),
3393
- overrides: getOverrides(options, "pnpm")
3394
- })
3395
- );
3472
+ configs.push(configPnpm(resolveSubOptions(options, "pnpm")));
3396
3473
  }
3397
3474
  if (enableSVGO) {
3398
3475
  configs.push(configSVGO(resolveSubOptions(options, "svgo")));
@@ -3413,4 +3490,4 @@ function defineESLintConfig(options = {}, ...userConfigs) {
3413
3490
  return composer;
3414
3491
  }
3415
3492
 
3416
- export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_DIST, GLOB_DTS, GLOB_EXCLUDE, GLOB_GITHUB_ACTION, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_JSX_ONLY, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_NESTED, GLOB_NODE_MODULES, GLOB_PACKAGE_JSON, GLOB_PINIA_STORE, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TEST, GLOB_TOML, GLOB_TS, GLOB_TSCONFIG_JSON, GLOB_TSX, GLOB_TSX_ONLY, GLOB_TYPES, GLOB_TYPE_TEST, GLOB_VUE, GLOB_YAML, PERFECTIONIST_COMMON_RULE_OPTIONS, PERFECTIONIST_EXTRA_RULE_OPTIONS, PERFECTIONIST_SORT_CLASSES_GROUPS, PERFECTIONIST_SORT_IMPORTS_GROUPS, PERFECTIONIST_SORT_INTERFACES_OR_OBJECT_TYPES_GROUPS, PERFECTIONIST_SORT_INTERSECTION_TYPES_OR_UNION_TYPES_GROUPS, PERFECTIONIST_SORT_OBJECTS_GROUPS, PRETTIER_DEFAULT_OPTIONS, combineConfigs, configAntfu, configCommand, configDeMorgan, configDepend, configESLintComments, configESLintPlugin, configFormat, configGitHubAction, configGitIgnore, configIgnores, configImportX, configJSX, configJavaScript, configJsdoc, configJsonc, configMarkdown, configNode, configNtnyq, configPerfectionist, configPinia, configPnpm, configPrettier, configRegexp, configSVGO, configSort, configSpecials, configTest, configToml, configTypeScript, configUnicorn, configUnoCSS, configUnusedImports, configVue, configYml, defineESLintConfig, ensurePackages, getOverrides, hasPinia, hasShadcnVue, hasTypeScript, hasUnoCSS, hasVitest, hasVue, interopDefault, isInGitHooksOrRunBySpecifyPackages, mergePrettierOptions, parserPlain, resolveSubOptions };
3493
+ export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_DIST, GLOB_DTS, GLOB_EXCLUDE, GLOB_GITHUB_ACTION, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSON_SCHEMA, GLOB_JSX, GLOB_JSX_ONLY, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_NESTED, GLOB_NODE_MODULES, GLOB_PACKAGE_JSON, GLOB_PINIA_STORE, GLOB_PNPM_WORKSPACE_YAML, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TEST, GLOB_TOML, GLOB_TS, GLOB_TSCONFIG_JSON, GLOB_TSX, GLOB_TSX_ONLY, GLOB_TYPES, GLOB_TYPE_TEST, GLOB_VUE, GLOB_YAML, PERFECTIONIST_COMMON_RULE_OPTIONS, PERFECTIONIST_EXTRA_RULE_OPTIONS, PERFECTIONIST_SORT_CLASSES_GROUPS, PERFECTIONIST_SORT_IMPORTS_GROUPS, PERFECTIONIST_SORT_INTERFACES_OR_OBJECT_TYPES_GROUPS, PERFECTIONIST_SORT_INTERSECTION_TYPES_OR_UNION_TYPES_GROUPS, PERFECTIONIST_SORT_OBJECTS_GROUPS, PRETTIER_DEFAULT_OPTIONS, combineConfigs, configAntfu, configCommand, configDeMorgan, configDepend, configESLintComments, configESLintPlugin, configFormat, configGitHubAction, configGitIgnore, configIgnores, configImportX, configJSX, configJavaScript, configJsdoc, configJsonc, configMarkdown, configNode, configNtnyq, configPerfectionist, configPinia, configPnpm, configPrettier, configRegexp, configSVGO, configSort, configSpecials, configTest, configToml, configTypeScript, configUnicorn, configUnoCSS, configUnusedImports, configVue, configYml, defineESLintConfig, ensurePackages, getOverrides, hasPinia, hasShadcnVue, hasTypeScript, hasUnoCSS, hasVitest, hasVue, interopDefault, isInGitHooksOrRunBySpecifyPackages, mergePrettierOptions, parserPlain, resolveSubOptions };
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@ntnyq/eslint-config",
3
3
  "type": "module",
4
- "version": "4.0.1",
5
- "packageManager": "pnpm@10.6.2",
4
+ "version": "4.0.3",
5
+ "packageManager": "pnpm@10.7.0",
6
6
  "description": "An opinionated ESLint config preset of ntnyq",
7
7
  "keywords": [
8
8
  "eslint",
@@ -76,33 +76,33 @@
76
76
  "@antfu/install-pkg": "^1.0.0",
77
77
  "@clack/prompts": "^0.10.0",
78
78
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
79
- "@eslint/js": "^9.22.0",
79
+ "@eslint/js": "^9.23.0",
80
80
  "@eslint/markdown": "^6.3.0",
81
- "@unocss/eslint-plugin": "^66.1.0-beta.3",
82
- "@vitest/eslint-plugin": "^1.1.37",
81
+ "@unocss/eslint-plugin": "^66.1.0-beta.8",
82
+ "@vitest/eslint-plugin": "^1.1.38",
83
83
  "eslint-config-flat-gitignore": "^2.1.0",
84
84
  "eslint-flat-config-utils": "^2.0.1",
85
- "eslint-import-resolver-typescript": "^3.8.4",
85
+ "eslint-import-resolver-typescript": "^4.3.1",
86
86
  "eslint-merge-processors": "^2.0.0",
87
87
  "eslint-plugin-antfu": "^3.1.1",
88
- "eslint-plugin-command": "^3.1.0",
89
- "eslint-plugin-de-morgan": "^1.2.0",
88
+ "eslint-plugin-command": "^3.2.0",
89
+ "eslint-plugin-de-morgan": "^1.2.1",
90
90
  "eslint-plugin-depend": "^0.12.0",
91
- "eslint-plugin-github-action": "^0.0.14",
92
- "eslint-plugin-import-x": "^4.6.1",
93
- "eslint-plugin-jsdoc": "^50.6.6",
94
- "eslint-plugin-jsonc": "^2.19.1",
95
- "eslint-plugin-n": "^17.16.2",
91
+ "eslint-plugin-github-action": "^0.0.15",
92
+ "eslint-plugin-import-x": "^4.10.0",
93
+ "eslint-plugin-jsdoc": "^50.6.9",
94
+ "eslint-plugin-jsonc": "^2.20.0",
95
+ "eslint-plugin-n": "^17.17.0",
96
96
  "eslint-plugin-no-only-tests": "^3.3.0",
97
- "eslint-plugin-ntnyq": "^0.10.0",
97
+ "eslint-plugin-ntnyq": "^0.11.0",
98
98
  "eslint-plugin-perfectionist": "^4.10.1",
99
99
  "eslint-plugin-pinia": "^0.4.1",
100
- "eslint-plugin-pnpm": "^0.1.2",
101
- "eslint-plugin-prettier": "^5.2.3",
100
+ "eslint-plugin-pnpm": "^0.3.1",
101
+ "eslint-plugin-prettier": "^5.2.5",
102
102
  "eslint-plugin-regexp": "^2.7.0",
103
- "eslint-plugin-svgo": "^0.6.0",
103
+ "eslint-plugin-svgo": "^0.7.0",
104
104
  "eslint-plugin-toml": "^0.12.0",
105
- "eslint-plugin-unicorn": "^57.0.0",
105
+ "eslint-plugin-unicorn": "^58.0.0",
106
106
  "eslint-plugin-vue": "^10.0.0",
107
107
  "eslint-plugin-yml": "^1.17.0",
108
108
  "eslint-processor-vue-blocks": "^2.0.0",
@@ -111,17 +111,18 @@
111
111
  "local-pkg": "^1.1.1",
112
112
  "prettier": "^3.5.3",
113
113
  "toml-eslint-parser": "^0.10.0",
114
- "typescript-eslint": "^8.26.1",
114
+ "typescript-eslint": "^8.29.0",
115
115
  "vue-eslint-parser": "^10.1.1",
116
116
  "yaml-eslint-parser": "^1.3.0"
117
117
  },
118
118
  "devDependencies": {
119
119
  "@ntnyq/prettier-config": "^2.0.0",
120
- "@types/node": "^22.13.10",
121
- "bumpp": "^10.0.3",
122
- "eslint": "^9.22.0",
120
+ "@types/node": "^22.13.14",
121
+ "bumpp": "^10.1.0",
122
+ "eslint": "^9.23.0",
123
+ "eslint-parser-plain": "^0.1.1",
123
124
  "eslint-plugin-eslint-plugin": "^6.4.0",
124
- "eslint-typegen": "^2.0.0",
125
+ "eslint-typegen": "^2.1.0",
125
126
  "husky": "^9.1.7",
126
127
  "jiti": "^2.4.2",
127
128
  "nano-staged": "^0.8.0",
@@ -131,7 +132,7 @@
131
132
  "typescript": "^5.8.2",
132
133
  "unbuild": "^3.5.0",
133
134
  "uncase": "^0.0.4",
134
- "vitest": "^3.0.8"
135
+ "vitest": "^3.1.1"
135
136
  },
136
137
  "engines": {
137
138
  "node": ">=18.18.0"