@component-hook/eslint-plugin 1.4.1 → 1.4.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.
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
- Object.defineProperty(exports, '__esModule', { value: true });
2
- //#region rolldown:runtime
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
+ //#region \0rolldown/runtime.js
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -76,8 +76,7 @@ let jsonc_eslint_parser = require("jsonc-eslint-parser");
76
76
  jsonc_eslint_parser = __toESM(jsonc_eslint_parser);
77
77
  let eslint_plugin_yml = require("eslint-plugin-yml");
78
78
  eslint_plugin_yml = __toESM(eslint_plugin_yml);
79
- let yaml_eslint_parser = require("yaml-eslint-parser");
80
- yaml_eslint_parser = __toESM(yaml_eslint_parser);
79
+ let eslint_config = require("eslint/config");
81
80
 
82
81
  //#region configs/comments.ts
83
82
  const commentsConfigs = [{
@@ -140,7 +139,7 @@ const VUE = "**/*.vue";
140
139
  const BLOB_JSON = "**/*.json";
141
140
  const JSON5 = "**/*.json5";
142
141
  const JSONC = "**/*.jsonc";
143
- const YAML = "**/*.y?(a)ml";
142
+ const RESTRICTED_SYNTAX = ["ForInStatement", "LabeledStatement"];
144
143
 
145
144
  //#endregion
146
145
  //#region configs/import.ts
@@ -185,33 +184,31 @@ const importConfigs = [{
185
184
 
186
185
  //#endregion
187
186
  //#region configs/javascript.ts
188
- const rules$3 = {
189
- "no-useless-call": "error",
190
- "no-useless-computed-key": "error",
191
- "no-useless-constructor": "error",
192
- "no-useless-rename": "error",
193
- "no-var": "error",
194
- "no-console": ["warn", { allow: [
195
- "warn",
196
- "error",
197
- "info",
198
- "clear"
199
- ] }],
200
- "no-debugger": "warn",
201
- "no-eval": "error",
202
- "no-loop-func": "error",
203
- "no-dupe-class-members": "error",
204
- "no-duplicate-imports": "error",
205
- "object-shorthand": "error",
206
- "prefer-const": "error",
207
- "prefer-template": "error",
208
- eqeqeq: "error"
209
- };
210
187
  const jsConfigs = [{
211
188
  name: "component-hook/javascript",
212
189
  rules: {
213
190
  ..._eslint_js.default.configs.recommended.rules,
214
- ...rules$3
191
+ "no-useless-call": "error",
192
+ "no-useless-computed-key": "error",
193
+ "no-useless-constructor": "error",
194
+ "no-useless-rename": "error",
195
+ "no-var": "error",
196
+ "no-console": ["warn", { allow: [
197
+ "warn",
198
+ "error",
199
+ "info",
200
+ "clear"
201
+ ] }],
202
+ "no-debugger": "warn",
203
+ "no-eval": "error",
204
+ "no-loop-func": "error",
205
+ "no-dupe-class-members": "error",
206
+ "no-duplicate-imports": "error",
207
+ "object-shorthand": "error",
208
+ "prefer-const": "error",
209
+ "prefer-template": "error",
210
+ eqeqeq: "error",
211
+ "no-restricted-syntax": ["error", ...RESTRICTED_SYNTAX]
215
212
  }
216
213
  }, {
217
214
  name: "component-hook/globals",
@@ -219,7 +216,8 @@ const jsConfigs = [{
219
216
  ecmaVersion: "latest",
220
217
  globals: {
221
218
  ...globals.default.node,
222
- ...globals.default.browser
219
+ ...globals.default.browser,
220
+ ...globals.default.es2026
223
221
  }
224
222
  }
225
223
  }];
@@ -335,8 +333,8 @@ const jsoncConfigs = [
335
333
  {
336
334
  order: [
337
335
  "types",
338
- "require",
339
336
  "import",
337
+ "require",
340
338
  "default"
341
339
  ],
342
340
  pathPattern: "^exports.*$"
@@ -487,7 +485,6 @@ const markdownConfigs = [..._eslint_markdown.default.configs.processor.map((conf
487
485
  "@typescript-eslint/no-unused-expressions": "off",
488
486
  "@typescript-eslint/no-unused-vars": "off",
489
487
  "@typescript-eslint/no-use-before-define": "off",
490
- "import/no-default-export": "off",
491
488
  "sonarjs/no-dead-store": "off",
492
489
  "sonarjs/unused-import": "off",
493
490
  "sonarjs/no-unused-vars": "off",
@@ -540,13 +537,13 @@ const playwrightConfig = {
540
537
 
541
538
  //#endregion
542
539
  //#region configs/prettier.ts
543
- const rules$2 = { ...eslint_plugin_prettier_recommended.default.rules };
544
- delete rules$2["vue/html-self-closing"];
540
+ const rules$1 = { ...eslint_plugin_prettier_recommended.default.rules };
541
+ delete rules$1["vue/html-self-closing"];
545
542
  const prettierConfig = {
546
543
  name: "component-hook/prettier",
547
544
  plugins: { prettier: eslint_plugin_prettier.default },
548
545
  rules: {
549
- ...rules$2,
546
+ ...rules$1,
550
547
  "prettier/prettier": "warn"
551
548
  }
552
549
  };
@@ -596,12 +593,13 @@ const securityConfig = {
596
593
  //#endregion
597
594
  //#region configs/sonarjs.ts
598
595
  const plugins$1 = { sonarjs: eslint_plugin_sonarjs.default };
599
- const { settings } = eslint_plugin_sonarjs.default.configs.recommended;
596
+ const recommended = eslint_plugin_sonarjs.default.configs?.recommended;
597
+ const { settings } = recommended;
600
598
  const sonarjsConfigs = [{
601
599
  name: "component-hook/sonarjs",
602
600
  plugins: plugins$1,
603
601
  rules: {
604
- ...eslint_plugin_sonarjs.default.configs.recommended.rules,
602
+ ...recommended.rules,
605
603
  "sonarjs/no-commented-code": "warn"
606
604
  },
607
605
  settings
@@ -648,26 +646,51 @@ const testingLibraryMarkoConfig = {
648
646
 
649
647
  //#endregion
650
648
  //#region configs/typescript.ts
651
- const rules$1 = {
652
- "@typescript-eslint/ban-ts-comment": "off",
653
- "@typescript-eslint/no-explicit-any": "off",
654
- "@typescript-eslint/no-unsafe-function-type": "off",
655
- "@typescript-eslint/no-shadow": "error",
656
- "@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "_" }],
657
- "@typescript-eslint/no-useless-constructor": "error",
658
- "@typescript-eslint/prefer-literal-enum-member": ["error", { allowBitwiseExpressions: true }],
659
- "@typescript-eslint/no-unused-expressions": ["error", {
660
- allowShortCircuit: true,
661
- allowTaggedTemplates: true,
662
- allowTernary: true
663
- }]
664
- };
665
- const typescriptConfigs = typescript_eslint.default.config({
649
+ const typescriptCoreConfig = (0, eslint_config.defineConfig)({
666
650
  extends: [...typescript_eslint.default.configs.recommended],
667
651
  files: ["**/*.ts", "**/*.tsx"],
668
652
  name: "component-hook/typescript",
669
- rules: rules$1
653
+ rules: {
654
+ "@typescript-eslint/ban-ts-comment": "off",
655
+ "@typescript-eslint/no-explicit-any": "off",
656
+ "@typescript-eslint/no-unsafe-function-type": "off",
657
+ "@typescript-eslint/no-shadow": "error",
658
+ "@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "_" }],
659
+ "@typescript-eslint/no-useless-constructor": "error",
660
+ "@typescript-eslint/prefer-literal-enum-member": ["error", { allowBitwiseExpressions: true }],
661
+ "@typescript-eslint/no-unused-expressions": ["error", {
662
+ allowShortCircuit: true,
663
+ allowTaggedTemplates: true,
664
+ allowTernary: true
665
+ }],
666
+ "@typescript-eslint/consistent-type-assertions": ["error", {
667
+ assertionStyle: "as",
668
+ objectLiteralTypeAssertions: "allow-as-parameter"
669
+ }],
670
+ "@typescript-eslint/consistent-type-imports": ["error", {
671
+ disallowTypeAnnotations: false,
672
+ fixStyle: "inline-type-imports"
673
+ }],
674
+ "@typescript-eslint/method-signature-style": ["error", "property"],
675
+ "@typescript-eslint/no-import-type-side-effects": "error",
676
+ "@typescript-eslint/no-redeclare": "error",
677
+ "no-restricted-syntax": [
678
+ "error",
679
+ "TSEnumDeclaration[const=true]",
680
+ ...RESTRICTED_SYNTAX
681
+ ]
682
+ }
670
683
  });
684
+ const typescriptConfigs = [...typescriptCoreConfig, {
685
+ files: ["**/*.d.ts"],
686
+ name: "component-hook/typescript/dts-rules",
687
+ rules: {
688
+ "eslint-comments/no-unlimited-disable": "off",
689
+ "import/no-duplicates": "off",
690
+ "no-restricted-syntax": "off",
691
+ "unused-imports/no-unused-vars": "off"
692
+ }
693
+ }];
671
694
 
672
695
  //#endregion
673
696
  //#region configs/unicorn.ts
@@ -719,9 +742,9 @@ const unicornConfigs = [
719
742
 
720
743
  //#endregion
721
744
  //#region configs/vue.ts
722
- const recommendedRules = eslint_plugin_vue.default.configs["flat/recommended"].map((config) => config.rules).reduce((acc, rules$4) => ({
745
+ const recommendedRules = eslint_plugin_vue.default.configs["flat/recommended"].map((config) => config.rules).reduce((acc, rules) => ({
723
746
  ...acc,
724
- ...rules$4
747
+ ...rules
725
748
  }), {});
726
749
  const rules = {
727
750
  "vue/block-order": ["error", { order: [
@@ -765,72 +788,55 @@ const rules = {
765
788
  "vue/no-setup-props-reactivity-loss": "off",
766
789
  "vue/return-in-computed-property": ["error", { treatUndefinedAsUnspecified: false }]
767
790
  };
768
- const extendsTypescript = typescript_eslint.default.configs.recommended.filter(({ name }) => name !== "typescript-eslint/base").map((config) => ({
791
+ const eslintVueTypescript = typescriptCoreConfig.filter(({ name }) => name !== "component-hook/typescript > typescript-eslint/base").map((config) => ({
769
792
  ...config,
770
- name: `component-hook/vue/${config.name}`
793
+ files: [VUE],
794
+ name: `component-hook/vue/${config.name?.replace("component-hook/", "")}`
771
795
  }));
772
- const eslintConfigTypescript = typescript_eslint.default.config({
773
- extends: extendsTypescript,
796
+ const vueConfigs = [...eslintVueTypescript, {
797
+ name: "component-hook/vue",
774
798
  files: [VUE],
775
- name: "component-hook/vue/typescript",
776
- rules: rules$1
777
- });
778
- const vueConfigs = [
779
- ...eslintConfigTypescript,
780
- {
781
- name: "component-hook/vue/globals",
782
- files: [VUE],
783
- languageOptions: { globals: {
784
- defineProps: "readonly",
785
- defineEmits: "readonly",
786
- defineExpose: "readonly",
787
- defineModel: "readonly",
788
- withDefaults: "readonly",
789
- $: "readonly",
790
- $$: "readonly",
791
- $computed: "readonly",
792
- $customRef: "readonly",
793
- $ref: "readonly",
794
- $shallowRef: "readonly",
795
- $toRef: "readonly"
796
- } }
799
+ plugins: {
800
+ "@typescript-eslint": typescript_eslint.default.plugin,
801
+ vue: eslint_plugin_vue.default
797
802
  },
798
- {
799
- name: "component-hook/vue",
800
- files: [VUE],
801
- plugins: {
802
- "@typescript-eslint": typescript_eslint.default.plugin,
803
- vue: eslint_plugin_vue.default
804
- },
805
- languageOptions: {
806
- parser: vue_eslint_parser.default,
807
- parserOptions: {
808
- parser: "@typescript-eslint/parser",
809
- extraFileExtensions: [".vue"],
810
- sourceType: "module",
811
- ecmaFeatures: { jsx: true }
812
- }
813
- },
814
- processor: eslint_plugin_vue.default.processors[".vue"],
815
- rules: {
816
- ...recommendedRules,
817
- ...rules
803
+ languageOptions: {
804
+ parser: vue_eslint_parser.default,
805
+ parserOptions: {
806
+ parser: typescript_eslint.default.parser,
807
+ extraFileExtensions: [".vue"],
808
+ sourceType: "module",
809
+ ecmaFeatures: { jsx: true }
818
810
  }
811
+ },
812
+ processor: eslint_plugin_vue.default.processors[".vue"],
813
+ rules: {
814
+ ...recommendedRules,
815
+ "no-useless-assignment": "off",
816
+ ...rules
819
817
  }
820
- ];
818
+ }];
821
819
 
822
820
  //#endregion
823
821
  //#region configs/yaml.ts
822
+ const initialRules = { rules: { "yml/no-empty-mapping-value": "off" } };
823
+ const mergedConfig = Array.from(new Set([
824
+ ...eslint_plugin_yml.default.configs.standard,
825
+ ...eslint_plugin_yml.default.configs.prettier,
826
+ initialRules
827
+ ])).reduce((map, config) => {
828
+ return {
829
+ ...map,
830
+ ...config,
831
+ rules: {
832
+ ...map.rules,
833
+ ...config.rules
834
+ }
835
+ };
836
+ }, {});
824
837
  const yamlConfigs = [{
825
- name: "component-hook/yaml",
826
- files: [YAML],
827
- plugins: { yml: eslint_plugin_yml.default },
828
- languageOptions: { parser: yaml_eslint_parser.default },
829
- rules: {
830
- ...eslint_plugin_yml.default.configs.standard.rules,
831
- ...eslint_plugin_yml.default.configs.prettier.rules,
832
- "yml/no-empty-mapping-value": "off"
833
- }
838
+ ...mergedConfig,
839
+ name: "component-hook/yaml"
834
840
  }, {
835
841
  name: "component-hook/yaml/pnpm-workspace",
836
842
  files: ["**/pnpm-workspace.yaml"],