eslint-config-un 0.3.0 → 0.3.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.
package/README.md CHANGED
@@ -37,6 +37,7 @@ Includes the rules from the following configs & plugins:
37
37
  - [css](https://www.npmjs.com/package/eslint-plugin-css) (since v0.2.0)
38
38
  - [jest](https://www.npmjs.com/package/eslint-plugin-jest) (+ [jest-extended](https://www.npmjs.com/package/eslint-plugin-jest-extended)) (since v0.3.0)
39
39
  - [vitest](https://www.npmjs.com/package/@vitest/eslint-plugin) (since v0.3.0)
40
+ - [jsdoc](https://www.npmjs.com/package/eslint-plugin-jsdoc) (since v0.3.1)
40
41
 
41
42
  ## Features
42
43
 
package/dist/index.cjs CHANGED
@@ -453,6 +453,15 @@ var createPluginObjectRenamer = (from, to) => {
453
453
  ])
454
454
  );
455
455
  };
456
+ var bulkChangeRuleSeverity = (rules, severity) => Object.fromEntries(
457
+ Object.entries(rules).map(
458
+ ([ruleName, ruleOptions]) => [
459
+ ruleName,
460
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
461
+ Array.isArray(ruleOptions) ? [severity, ...ruleOptions.slice(1)] : severity
462
+ ]
463
+ )
464
+ );
456
465
  var ConfigEntryBuilder = class {
457
466
  constructor(options, internalOptions) {
458
467
  this.options = options;
@@ -878,6 +887,53 @@ var jsEslintConfig = (options = {}, internalOptions = {}) => {
878
887
  return builder.getAllConfigs();
879
888
  };
880
889
 
890
+ // src/configs/jsdoc.ts
891
+ init_cjs_shims();
892
+ var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
893
+ var jsdocEslintConfig = (options = {}, internalOptions = {}) => {
894
+ const {
895
+ settings: pluginSettings,
896
+ typescript: typescriptOnlyRules = internalOptions.isTypescriptEnabled
897
+ } = options;
898
+ const builder = new ConfigEntryBuilder(options, internalOptions);
899
+ builder.addConfig("jsdoc/setup", {
900
+ plugins: {
901
+ jsdoc: import_eslint_plugin_jsdoc.default
902
+ }
903
+ });
904
+ builder.addConfig(["jsdoc", { includeDefaultFilesAndIgnores: true }], {
905
+ ...pluginSettings && {
906
+ settings: {
907
+ jsdoc: pluginSettings
908
+ }
909
+ }
910
+ }).addBulkRules(import_eslint_plugin_jsdoc.default.configs["flat/recommended-error"].rules).addRule("jsdoc/check-indentation", ERROR).addRule("jsdoc/check-line-alignment", ERROR).addRule("jsdoc/check-syntax", ERROR).addRule("jsdoc/check-template-names", ERROR).addRule("jsdoc/lines-before-block", ERROR).addRule("jsdoc/no-bad-blocks", ERROR).addRule("jsdoc/no-blank-block-descriptions", ERROR).addRule("jsdoc/no-blank-blocks", ERROR).addRule("jsdoc/no-defaults", ERROR).addRule("jsdoc/no-multi-asterisks", ERROR, [{ allowWhitespace: true }]).addRule("jsdoc/require-asterisk-prefix", ERROR).addRule("jsdoc/require-jsdoc", OFF).addRule("jsdoc/require-param", ERROR, [{ ignoreWhenAllParamsMissing: true }]).addRule("jsdoc/require-param-description", WARNING).addRule("jsdoc/require-property-description", WARNING).addRule("jsdoc/require-returns", OFF).addRule("jsdoc/require-returns-description", WARNING).addRule("jsdoc/sort-tags", ERROR).addOverrides();
911
+ const tsBuilder = new ConfigEntryBuilder(
912
+ typeof typescriptOnlyRules === "object" ? typescriptOnlyRules : {},
913
+ internalOptions
914
+ );
915
+ if (typescriptOnlyRules) {
916
+ const pluginSettingsForTs = (typeof typescriptOnlyRules === "object" ? typescriptOnlyRules.settings : void 0) || pluginSettings;
917
+ builder.addConfig(
918
+ [
919
+ "jsdoc/ts",
920
+ {
921
+ includeDefaultFilesAndIgnores: true,
922
+ filesFallback: [GLOB_TS, GLOB_TSX]
923
+ }
924
+ ],
925
+ {
926
+ ...pluginSettingsForTs && {
927
+ settings: {
928
+ jsdoc: pluginSettingsForTs
929
+ }
930
+ }
931
+ }
932
+ ).addRule("jsdoc/no-types", ERROR).addRule("jsdoc/no-undefined-types", OFF).addRule("jsdoc/require-param-type", OFF).addRule("jsdoc/require-property-type", OFF).addRule("jsdoc/require-returns-type", OFF).addOverrides();
933
+ }
934
+ return [...builder.getAllConfigs(), ...tsBuilder.getAllConfigs()];
935
+ };
936
+
881
937
  // src/configs/jsonc.ts
882
938
  init_cjs_shims();
883
939
  var import_eslint_plugin_jsonc = __toESM(require("eslint-plugin-jsonc"), 1);
@@ -1454,7 +1510,7 @@ var tsEslintConfig = (options = {}, internalOptions = {}) => {
1454
1510
  }).addAnyRule("constructor-super", OFF).addAnyRule("getter-return", OFF).addAnyRule("no-const-assign", OFF).addAnyRule("no-dupe-args", OFF).addAnyRule("no-dupe-class-members", OFF).addAnyRule("no-dupe-keys", OFF).addAnyRule("no-func-assign", OFF).addAnyRule("no-new-native-nonconstructor", OFF).addAnyRule("no-obj-calls", OFF).addAnyRule("no-setter-return", OFF).addAnyRule("no-this-before-super", OFF).addAnyRule("no-undef", OFF).addAnyRule("no-unsafe-negation", OFF).addAnyRule("no-duplicate-imports", OFF);
1455
1511
  builder.addConfig("ts/dts", {
1456
1512
  files: ["**/*.d.?([cm])ts"]
1457
- }).addRule("@typescript-eslint/consistent-indexed-object-style", OFF).addRule("@typescript-eslint/method-signature-style", OFF).addRule("@typescript-eslint/no-empty-object-type", OFF).addRule("@typescript-eslint/no-explicit-any", OFF).addRule("@typescript-eslint/no-shadow", OFF).addRule("@typescript-eslint/no-unnecessary-type-parameters", OFF).addRule("@typescript-eslint/no-unused-vars", OFF).addRule("@typescript-eslint/no-use-before-define", OFF).addAnyRule("import/newline-after-import", OFF).addAnyRule("import/no-default-export", OFF);
1513
+ }).addRule("@typescript-eslint/consistent-indexed-object-style", OFF).addRule("@typescript-eslint/method-signature-style", OFF).addRule("@typescript-eslint/no-empty-object-type", OFF).addRule("@typescript-eslint/no-explicit-any", OFF).addRule("@typescript-eslint/no-shadow", OFF).addRule("@typescript-eslint/no-unnecessary-type-parameters", OFF).addRule("@typescript-eslint/no-unused-vars", OFF).addRule("@typescript-eslint/no-use-before-define", OFF).addAnyRule("import/newline-after-import", OFF).addAnyRule("import/no-default-export", OFF).addAnyRule("vars-on-top", OFF).addAnyRule("no-var", OFF);
1458
1514
  if (options.noTypeAssertion) {
1459
1515
  builder.addConfig("ts/no-type-assertion", {
1460
1516
  plugins: {
@@ -1620,7 +1676,8 @@ var vueEslintConfig = (options, internalOptions = {}) => {
1620
1676
  const isLess2_6 = isVue2 && vueMajorAndMinorVersion < 2.6;
1621
1677
  const isLess3_1 = vueMajorAndMinorVersion < 3.1;
1622
1678
  const isNuxtEnabled = Boolean(options.nuxtMajorVersion);
1623
- const recommendedRules = import_eslint_plugin_vue.default.configs[isVue3 ? "flat/recommended" : "flat/vue2-recommended"].reduce((result, config) => Object.assign(result, config.rules), {});
1679
+ const recommendedRulesRaw = import_eslint_plugin_vue.default.configs[isVue3 ? "flat/recommended" : "flat/vue2-recommended"].reduce((result, config) => Object.assign(result, config.rules), {});
1680
+ const recommendedRules = bulkChangeRuleSeverity(recommendedRulesRaw, ERROR);
1624
1681
  const inNuxtAppDir = joinPaths.bind(null, options.nuxtOrVueProjectDir);
1625
1682
  const nuxtLayoutsFilesGlob = inNuxtAppDir("layouts/**/*.vue");
1626
1683
  const builder = new ConfigEntryBuilder(options, internalOptions);
@@ -1967,6 +2024,10 @@ var eslintConfig = (options = {}) => {
1967
2024
  const vitestOptions = {
1968
2025
  ...assignOptions(configsOptions, "vitest")
1969
2026
  };
2027
+ const isJsdocEnabled = Boolean(configsOptions.jsdoc ?? true);
2028
+ const jsdocOptions = {
2029
+ ...assignOptions(configsOptions, "jsdoc")
2030
+ };
1970
2031
  const isSecurityEnabled = Boolean(configsOptions.security ?? false);
1971
2032
  const securityOptions = {
1972
2033
  ...assignOptions(configsOptions, "security")
@@ -2041,6 +2102,7 @@ var eslintConfig = (options = {}) => {
2041
2102
  isCssInJsEnabled && cssInJsEslintConfig(cssInJsOptions, internalOptions),
2042
2103
  isJestEnabled && jestEslintConfig(jestOptions, internalOptions),
2043
2104
  isVitestEnabled && vitestEslintConfig(vitestOptions, internalOptions),
2105
+ isJsdocEnabled && jsdocEslintConfig(jsdocOptions, internalOptions),
2044
2106
  isSecurityEnabled && securityEslintConfig(securityOptions, internalOptions),
2045
2107
  isPreferArrowFunctionsEnabled && preferArrowFunctionsEslintConfig(preferArrowFunctionsOptions, internalOptions),
2046
2108
  isYamlEnabled && yamlEslintConfig(yamlOptions, internalOptions),
@@ -2057,11 +2119,24 @@ var eslintConfig = (options = {}) => {
2057
2119
  name: genFlatConfigEntryName("config-files"),
2058
2120
  files: GLOB_CONFIG_FILES,
2059
2121
  rules: {
2060
- "import/no-default-export": OFF,
2061
2122
  "import/no-extraneous-dependencies": OFF,
2062
2123
  "n/no-unpublished-require": OFF
2063
2124
  }
2064
2125
  },
2126
+ {
2127
+ name: genFlatConfigEntryName("allow-default-export"),
2128
+ files: [
2129
+ ...GLOB_CONFIG_FILES,
2130
+ // Files starting with a dot
2131
+ `**/.*.${GLOB_JS_TS_X_EXTENSION}`,
2132
+ // Storybook
2133
+ `**/*.stories.${GLOB_JS_TS_X_EXTENSION}`,
2134
+ ".storybook/**/*"
2135
+ ],
2136
+ rules: {
2137
+ "import/no-default-export": OFF
2138
+ }
2139
+ },
2065
2140
  ...options.extraConfigs || [],
2066
2141
  // MUST be last
2067
2142
  !options.disablePrettierIncompatibleRules && {