@so1ve/eslint-config 1.0.0-alpha.2 → 1.0.0-alpha.4

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
@@ -9,7 +9,7 @@ var pluginSo1ve = require('@so1ve/eslint-plugin');
9
9
  var pluginSortImports = require('@so1ve/eslint-plugin-sort-imports');
10
10
  var pluginTs = require('@typescript-eslint/eslint-plugin');
11
11
  var parserTs = require('@typescript-eslint/parser');
12
- var parserMdx = require('eslint-mdx');
12
+ var eslintMdx = require('eslint-mdx');
13
13
  var pluginArrayFunc = require('eslint-plugin-array-func');
14
14
  var pluginEtc = require('eslint-plugin-etc');
15
15
  var pluginHtmlJsSupport = require('eslint-plugin-html');
@@ -49,7 +49,7 @@ var pluginSo1ve__default = /*#__PURE__*/_interopDefaultLegacy(pluginSo1ve);
49
49
  var pluginSortImports__default = /*#__PURE__*/_interopDefaultLegacy(pluginSortImports);
50
50
  var pluginTs__default = /*#__PURE__*/_interopDefaultLegacy(pluginTs);
51
51
  var parserTs__default = /*#__PURE__*/_interopDefaultLegacy(parserTs);
52
- var parserMdx__default = /*#__PURE__*/_interopDefaultLegacy(parserMdx);
52
+ var eslintMdx__default = /*#__PURE__*/_interopDefaultLegacy(eslintMdx);
53
53
  var pluginArrayFunc__default = /*#__PURE__*/_interopDefaultLegacy(pluginArrayFunc);
54
54
  var pluginEtc__default = /*#__PURE__*/_interopDefaultLegacy(pluginEtc);
55
55
  var pluginHtmlJsSupport__default = /*#__PURE__*/_interopDefaultLegacy(pluginHtmlJsSupport);
@@ -111,7 +111,7 @@ const GLOB_JSON = "**/*.json";
111
111
  const GLOB_JSON5 = "**/*.json5";
112
112
  const GLOB_JSONC = "**/*.jsonc";
113
113
  const GLOB_ESLINTRC = "**/.eslintrc";
114
- const GLOB_MARKDOWN = "**/*.md?(x)";
114
+ const GLOB_MARKDOWN = "**/*.{md,mdx}";
115
115
  const GLOB_VUE = "**/*.vue";
116
116
  const GLOB_YAML = "**/*.y?(a)ml";
117
117
  const GLOB_TOML = "**/*.toml";
@@ -595,7 +595,6 @@ const jsdoc = () => [
595
595
  "jsdoc/multiline-blocks": "error",
596
596
  "jsdoc/no-defaults": "error",
597
597
  "jsdoc/no-multi-asterisks": "error",
598
- "jsdoc/no-types": "error",
599
598
  "jsdoc/require-param-name": "error",
600
599
  "jsdoc/require-property": "error",
601
600
  "jsdoc/require-property-description": "error",
@@ -650,37 +649,20 @@ const mdx = ({
650
649
  overrides
651
650
  } = {}) => [
652
651
  {
653
- plugins: {
654
- mdx: pluginMdx__default["default"]
655
- }
656
- },
657
- {
658
- languageOptions: {
659
- parser: parserMdx__default["default"]
660
- },
661
- settings: {
662
- "mdx/code-blocks": true
663
- },
664
- files: [GLOB_MARKDOWN],
665
- processor: "mdx/remark",
666
- rules: {
667
- "mdx/remark": "warn",
668
- "no-unused-expressions": "error"
669
- }
652
+ ...pluginMdx__default["default"].flat,
653
+ processor: pluginMdx__default["default"].createRemarkProcessor({
654
+ lintCodeBlocks: true,
655
+ languageMapper: {}
656
+ })
670
657
  },
671
658
  {
659
+ ...pluginMdx__default["default"].flatCodeBlocks,
672
660
  files: [
673
- GLOB_MARKDOWN_CODE,
674
- ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
661
+ ...pluginMdx__default["default"].flatCodeBlocks.files,
662
+ ...componentExts.map((ext) => `${GLOB_MARKDOWN}/*.${ext}`)
675
663
  ],
676
- languageOptions: {
677
- parserOptions: {
678
- ecmaFeatures: {
679
- impliedStrict: true
680
- }
681
- }
682
- },
683
664
  rules: {
665
+ ...pluginMdx__default["default"].flatCodeBlocks.rules,
684
666
  "html/require-doctype": "off",
685
667
  "ts/no-redeclare": "off",
686
668
  "ts/no-unused-vars": "off",
@@ -882,239 +864,233 @@ function warnUnnecessaryOffRules() {
882
864
  }
883
865
  }
884
866
 
885
- const typescript = ({
867
+ function typescript({
886
868
  componentExts = [],
869
+ parserOptions,
887
870
  overrides
888
- } = {}) => [
889
- {
890
- // Install the plugins without globs, so they can be configured separately.
891
- plugins: {
892
- import: pluginImport__default["default"],
893
- ts: pluginTs__default["default"]
894
- }
895
- },
896
- {
897
- files: [GLOB_TS, GLOB_TSX, ...componentExts.map((ext) => `**/*.${ext}`)],
898
- languageOptions: {
899
- parser: parserTs__default["default"],
900
- parserOptions: {
901
- sourceType: "module"
871
+ } = {}) {
872
+ const typeAwareRules = {
873
+ "etc/no-assign-mutated-array": "error",
874
+ "etc/no-deprecated": "warn",
875
+ "etc/no-internal": "error",
876
+ "no-throw-literal": "off",
877
+ "ts/no-throw-literal": "error",
878
+ "no-implied-eval": "off",
879
+ "ts/no-implied-eval": "error",
880
+ "dot-notation": "off",
881
+ "ts/dot-notation": ["error", { allowKeywords: true }],
882
+ "no-void": ["error", { allowAsStatement: true }],
883
+ "ts/await-thenable": "error",
884
+ "ts/no-for-in-array": "error",
885
+ "ts/no-unnecessary-type-assertion": "error",
886
+ "ts/restrict-template-expressions": [
887
+ "error",
888
+ {
889
+ allowAny: true,
890
+ allowNumber: true,
891
+ allowBoolean: true
902
892
  }
903
- },
904
- settings: {
905
- "import/resolver": {
906
- node: { extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"] },
907
- typescript: {
908
- extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"]
909
- }
893
+ ],
894
+ "ts/array-type": ["error", { default: "array", readonly: "array" }],
895
+ "ts/consistent-generic-constructors": "error",
896
+ "ts/consistent-type-exports": "error",
897
+ "ts/consistent-type-assertions": [
898
+ "error",
899
+ { assertionStyle: "as", objectLiteralTypeAssertions: "allow" }
900
+ ],
901
+ "ts/prefer-nullish-coalescing": "error",
902
+ "ts/prefer-optional-chain": "error",
903
+ "ts/prefer-return-this-type": "error",
904
+ "ts/no-unnecessary-type-arguments": "error",
905
+ "ts/non-nullable-type-assertion-style": "error"
906
+ };
907
+ return [
908
+ {
909
+ // Install the plugins without globs, so they can be configured separately.
910
+ plugins: {
911
+ import: pluginImport__default["default"],
912
+ ts: pluginTs__default["default"],
913
+ etc: pluginEtc__default["default"]
910
914
  }
911
915
  },
912
- rules: {
913
- ...renameRules(
914
- pluginTs__default["default"].configs["eslint-recommended"].overrides[0].rules,
915
- "@typescript-eslint/",
916
- "ts/"
917
- ),
918
- ...renameRules(
919
- pluginTs__default["default"].configs.recommended.rules,
920
- "@typescript-eslint/",
921
- "ts/"
922
- ),
923
- "import/named": "off",
924
- // TS
925
- "ts/comma-dangle": "off",
926
- "ts/brace-style": "off",
927
- "ts/comma-spacing": "off",
928
- "ts/func-call-spacing": "off",
929
- "ts/indent": "off",
930
- "ts/keyword-spacing": "off",
931
- "ts/member-delimiter-style": "off",
932
- "ts/no-extra-parens": "off",
933
- "ts/no-extra-semi": "off",
934
- "ts/quotes": "off",
935
- "ts/semi": "off",
936
- "ts/space-before-function-paren": "off",
937
- "ts/type-annotation-spacing": "off",
938
- "ts/ban-ts-comment": [
939
- "error",
940
- {
941
- minimumDescriptionLength: 0
916
+ {
917
+ files: [GLOB_TS, GLOB_TSX, ...componentExts.map((ext) => `**/*.${ext}`)],
918
+ languageOptions: {
919
+ parser: parserTs__default["default"],
920
+ parserOptions: {
921
+ sourceType: "module",
922
+ EXPERIMENTAL_useProjectService: true,
923
+ ...parserOptions
942
924
  }
943
- ],
944
- "ts/ban-types": [
945
- "error",
946
- {
947
- extendDefaults: false,
948
- types: {
949
- String: {
950
- message: "Use `string` instead.",
951
- fixWith: "string"
952
- },
953
- Number: {
954
- message: "Use `number` instead.",
955
- fixWith: "number"
956
- },
957
- Boolean: {
958
- message: "Use `boolean` instead.",
959
- fixWith: "boolean"
960
- },
961
- Symbol: {
962
- message: "Use `symbol` instead.",
963
- fixWith: "symbol"
964
- },
965
- BigInt: {
966
- message: "Use `bigint` instead.",
967
- fixWith: "bigint"
968
- },
969
- Object: {
970
- message: "The `Object` type is mostly the same as `unknown`. You probably want `Record<PropertyKey, unknown>` instead. See https://github.com/typescript-eslint/typescript-eslint/pull/848",
971
- fixWith: "Record<PropertyKey, unknown>"
972
- },
973
- object: {
974
- message: "The `object` type is hard to use. Use `Record<PropertyKey, unknown>` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848",
975
- fixWith: "Record<PropertyKey, unknown>"
976
- },
977
- Function: {
978
- message: "Use `(...args: any[]) => any` instead.",
979
- fixWith: "(...args: any[]) => any"
925
+ },
926
+ settings: {
927
+ "import/resolver": {
928
+ node: { extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"] },
929
+ typescript: {
930
+ extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"]
931
+ }
932
+ }
933
+ },
934
+ rules: {
935
+ ...renameRules(
936
+ pluginTs__default["default"].configs["eslint-recommended"].overrides[0].rules,
937
+ "@typescript-eslint/",
938
+ "ts/"
939
+ ),
940
+ ...renameRules(
941
+ pluginTs__default["default"].configs.recommended.rules,
942
+ "@typescript-eslint/",
943
+ "ts/"
944
+ ),
945
+ "import/named": "off",
946
+ // TS
947
+ "ts/comma-dangle": "off",
948
+ "ts/brace-style": "off",
949
+ "ts/comma-spacing": "off",
950
+ "ts/func-call-spacing": "off",
951
+ "ts/indent": "off",
952
+ "ts/keyword-spacing": "off",
953
+ "ts/member-delimiter-style": "off",
954
+ "ts/no-extra-parens": "off",
955
+ "ts/no-extra-semi": "off",
956
+ "ts/quotes": "off",
957
+ "ts/semi": "off",
958
+ "ts/space-before-function-paren": "off",
959
+ "ts/type-annotation-spacing": "off",
960
+ "ts/ban-ts-comment": [
961
+ "error",
962
+ {
963
+ minimumDescriptionLength: 0
964
+ }
965
+ ],
966
+ "ts/ban-types": [
967
+ "error",
968
+ {
969
+ extendDefaults: false,
970
+ types: {
971
+ String: {
972
+ message: "Use `string` instead.",
973
+ fixWith: "string"
974
+ },
975
+ Number: {
976
+ message: "Use `number` instead.",
977
+ fixWith: "number"
978
+ },
979
+ Boolean: {
980
+ message: "Use `boolean` instead.",
981
+ fixWith: "boolean"
982
+ },
983
+ Symbol: {
984
+ message: "Use `symbol` instead.",
985
+ fixWith: "symbol"
986
+ },
987
+ BigInt: {
988
+ message: "Use `bigint` instead.",
989
+ fixWith: "bigint"
990
+ },
991
+ Object: {
992
+ message: "The `Object` type is mostly the same as `unknown`. You probably want `Record<PropertyKey, unknown>` instead. See https://github.com/typescript-eslint/typescript-eslint/pull/848",
993
+ fixWith: "Record<PropertyKey, unknown>"
994
+ },
995
+ object: {
996
+ message: "The `object` type is hard to use. Use `Record<PropertyKey, unknown>` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848",
997
+ fixWith: "Record<PropertyKey, unknown>"
998
+ },
999
+ Function: {
1000
+ message: "Use `(...args: any[]) => any` instead.",
1001
+ fixWith: "(...args: any[]) => any"
1002
+ }
980
1003
  }
981
1004
  }
1005
+ ],
1006
+ "ts/consistent-type-imports": [
1007
+ "error",
1008
+ { prefer: "type-imports", disallowTypeAnnotations: false }
1009
+ ],
1010
+ "ts/consistent-type-definitions": ["error", "interface"],
1011
+ "ts/consistent-indexed-object-style": ["error", "record"],
1012
+ "ts/prefer-ts-expect-error": "error",
1013
+ "ts/no-require-imports": "error",
1014
+ "ts/method-signature-style": ["error", "property"],
1015
+ // Override JS
1016
+ "no-useless-constructor": "off",
1017
+ "no-invalid-this": "off",
1018
+ "ts/no-invalid-this": "error",
1019
+ "no-redeclare": "off",
1020
+ "ts/no-redeclare": "error",
1021
+ "no-use-before-define": "off",
1022
+ "ts/no-use-before-define": [
1023
+ "error",
1024
+ { functions: false, classes: false, variables: true }
1025
+ ],
1026
+ "object-curly-spacing": "off",
1027
+ "space-before-blocks": "off",
1028
+ "ts/space-before-blocks": "off",
1029
+ "space-before-function-paren": "off",
1030
+ "no-dupe-class-members": "off",
1031
+ "ts/no-dupe-class-members": "error",
1032
+ "no-loss-of-precision": "off",
1033
+ "ts/no-loss-of-precision": "error",
1034
+ "lines-between-class-members": "off",
1035
+ "ts/lines-between-class-members": [
1036
+ "error",
1037
+ "always",
1038
+ { exceptAfterSingleLine: true }
1039
+ ],
1040
+ // so1ve
1041
+ "so1ve/no-inline-type-import": "error",
1042
+ // off
1043
+ "ts/camelcase": "off",
1044
+ "ts/explicit-function-return-type": "off",
1045
+ "ts/explicit-member-accessibility": "off",
1046
+ "ts/no-explicit-any": "off",
1047
+ "ts/no-parameter-properties": "off",
1048
+ "ts/no-empty-interface": "off",
1049
+ "ts/ban-ts-ignore": "off",
1050
+ "ts/no-empty-function": "off",
1051
+ "ts/no-non-null-assertion": "off",
1052
+ "ts/explicit-module-boundary-types": "off",
1053
+ "ts/triple-slash-reference": "off",
1054
+ "ts/prefer-for-of": "error",
1055
+ "ts/no-duplicate-enum-values": "error",
1056
+ "ts/no-non-null-asserted-nullish-coalescing": "error",
1057
+ // handled by unused-imports/no-unused-imports
1058
+ "ts/no-unused-vars": "off",
1059
+ ...typeAwareRules,
1060
+ ...overrides
1061
+ }
1062
+ },
1063
+ {
1064
+ files: [GLOB_MARKDOWN_CODE],
1065
+ languageOptions: {
1066
+ parser: parserTs__default["default"],
1067
+ parserOptions: {
1068
+ sourceType: "module"
982
1069
  }
983
- ],
984
- "ts/consistent-type-imports": [
985
- "error",
986
- { prefer: "type-imports", disallowTypeAnnotations: false }
987
- ],
988
- "ts/consistent-type-definitions": ["error", "interface"],
989
- "ts/consistent-indexed-object-style": ["error", "record"],
990
- "ts/prefer-ts-expect-error": "error",
991
- "ts/no-require-imports": "error",
992
- "ts/method-signature-style": ["error", "property"],
993
- // Override JS
994
- "no-useless-constructor": "off",
995
- "no-invalid-this": "off",
996
- "ts/no-invalid-this": "error",
997
- "no-redeclare": "off",
998
- "ts/no-redeclare": "error",
999
- "no-use-before-define": "off",
1000
- "ts/no-use-before-define": [
1001
- "error",
1002
- { functions: false, classes: false, variables: true }
1003
- ],
1004
- "object-curly-spacing": "off",
1005
- "space-before-blocks": "off",
1006
- "ts/space-before-blocks": "off",
1007
- "space-before-function-paren": "off",
1008
- "no-dupe-class-members": "off",
1009
- "ts/no-dupe-class-members": "error",
1010
- "no-loss-of-precision": "off",
1011
- "ts/no-loss-of-precision": "error",
1012
- "lines-between-class-members": "off",
1013
- "ts/lines-between-class-members": [
1014
- "error",
1015
- "always",
1016
- { exceptAfterSingleLine: true }
1017
- ],
1018
- // so1ve
1019
- "so1ve/no-inline-type-import": "error",
1020
- // off
1021
- "ts/camelcase": "off",
1022
- "ts/explicit-function-return-type": "off",
1023
- "ts/explicit-member-accessibility": "off",
1024
- "ts/no-explicit-any": "off",
1025
- "ts/no-parameter-properties": "off",
1026
- "ts/no-empty-interface": "off",
1027
- "ts/ban-ts-ignore": "off",
1028
- "ts/no-empty-function": "off",
1029
- "ts/no-non-null-assertion": "off",
1030
- "ts/explicit-module-boundary-types": "off",
1031
- "ts/triple-slash-reference": "off",
1032
- "ts/prefer-for-of": "error",
1033
- "ts/no-duplicate-enum-values": "error",
1034
- "ts/no-non-null-asserted-nullish-coalescing": "error",
1035
- // handled by unused-imports/no-unused-imports
1036
- "ts/no-unused-vars": "off",
1037
- ...overrides
1038
- }
1039
- },
1040
- {
1041
- files: ["**/*.d.ts"],
1042
- rules: {
1043
- "eslint-comments/no-unlimited-disable": "off",
1044
- "import/no-duplicates": "off",
1045
- "unused-imports/no-unused-vars": "off"
1046
- }
1047
- },
1048
- {
1049
- files: ["**/*.js", "**/*.cjs"],
1050
- rules: {
1051
- "ts/no-require-imports": "off",
1052
- "ts/no-var-requires": "off"
1053
- }
1054
- }
1055
- ];
1056
- const typescriptWithTypes = ({
1057
- componentExts = [],
1058
- tsconfigPath,
1059
- tsconfigRootDir = process.cwd(),
1060
- overrides = {}
1061
- }) => [
1062
- {
1063
- files: [
1064
- GLOB_TS,
1065
- GLOB_TSX,
1066
- ...componentExts.map((ext) => `**/*.${ext}`),
1067
- `!${GLOB_MARKDOWN}/*.*`
1068
- ],
1069
- plugins: {
1070
- etc: pluginEtc__default["default"]
1070
+ },
1071
+ rules: {
1072
+ ...Object.fromEntries(
1073
+ Object.keys(typeAwareRules).map((k) => [k, "off"])
1074
+ )
1075
+ }
1071
1076
  },
1072
- languageOptions: {
1073
- parser: parserTs__default["default"],
1074
- parserOptions: {
1075
- project: [tsconfigPath],
1076
- tsconfigRootDir,
1077
- EXPERIMENTAL_useProjectService: true
1077
+ {
1078
+ files: ["**/*.d.ts"],
1079
+ rules: {
1080
+ "eslint-comments/no-unlimited-disable": "off",
1081
+ "import/no-duplicates": "off",
1082
+ "unused-imports/no-unused-vars": "off"
1078
1083
  }
1079
1084
  },
1080
- rules: {
1081
- "etc/no-assign-mutated-array": "error",
1082
- "etc/no-deprecated": "warn",
1083
- "etc/no-internal": "error",
1084
- "no-throw-literal": "off",
1085
- "ts/no-throw-literal": "error",
1086
- "no-implied-eval": "off",
1087
- "ts/no-implied-eval": "error",
1088
- "dot-notation": "off",
1089
- "ts/dot-notation": ["error", { allowKeywords: true }],
1090
- "no-void": ["error", { allowAsStatement: true }],
1091
- "ts/await-thenable": "error",
1092
- "ts/no-for-in-array": "error",
1093
- "ts/no-unnecessary-type-assertion": "error",
1094
- "ts/restrict-template-expressions": [
1095
- "error",
1096
- {
1097
- allowAny: true,
1098
- allowNumber: true,
1099
- allowBoolean: true
1100
- }
1101
- ],
1102
- "ts/array-type": ["error", { default: "array", readonly: "array" }],
1103
- "ts/consistent-generic-constructors": "error",
1104
- "ts/consistent-type-exports": "error",
1105
- "ts/consistent-type-assertions": [
1106
- "error",
1107
- { assertionStyle: "as", objectLiteralTypeAssertions: "allow" }
1108
- ],
1109
- "ts/prefer-nullish-coalescing": "error",
1110
- "ts/prefer-optional-chain": "error",
1111
- "ts/prefer-return-this-type": "error",
1112
- "ts/no-unnecessary-type-arguments": "error",
1113
- "ts/non-nullable-type-assertion-style": "error",
1114
- ...overrides
1085
+ {
1086
+ files: ["**/*.js", "**/*.cjs"],
1087
+ rules: {
1088
+ "ts/no-require-imports": "off",
1089
+ "ts/no-var-requires": "off"
1090
+ }
1115
1091
  }
1116
- }
1117
- ];
1092
+ ];
1093
+ }
1118
1094
 
1119
1095
  const unicorn = () => [
1120
1096
  {
@@ -1414,7 +1390,7 @@ function so1ve(options = {}, ...userConfigs) {
1414
1390
  configs.push(
1415
1391
  ignores(),
1416
1392
  javascript({
1417
- // overrides: overrides.javascript,
1393
+ overrides: overrides.javascript
1418
1394
  }),
1419
1395
  comments(),
1420
1396
  node(),
@@ -1433,19 +1409,10 @@ function so1ve(options = {}, ...userConfigs) {
1433
1409
  if (enableTypeScript) {
1434
1410
  configs.push(
1435
1411
  typescript({
1436
- // componentExts,
1437
- // overrides: overrides.typescript,
1412
+ componentExts,
1413
+ overrides: overrides.typescript
1438
1414
  })
1439
1415
  );
1440
- if (typeof enableTypeScript !== "boolean") {
1441
- configs.push(
1442
- typescriptWithTypes({
1443
- ...enableTypeScript,
1444
- componentExts,
1445
- overrides: overrides.typescriptWithTypes
1446
- })
1447
- );
1448
- }
1449
1416
  }
1450
1417
  if ((_a = options.test) != null ? _a : true) {
1451
1418
  configs.push(
@@ -1538,7 +1505,7 @@ Object.defineProperty(exports, 'parserTs', {
1538
1505
  });
1539
1506
  Object.defineProperty(exports, 'parserMdx', {
1540
1507
  enumerable: true,
1541
- get: function () { return parserMdx__default["default"]; }
1508
+ get: function () { return eslintMdx__default["default"]; }
1542
1509
  });
1543
1510
  Object.defineProperty(exports, 'pluginArrayFunc', {
1544
1511
  enumerable: true,
@@ -1686,7 +1653,6 @@ exports.sortImports = sortImports;
1686
1653
  exports.test = test;
1687
1654
  exports.toml = toml;
1688
1655
  exports.typescript = typescript;
1689
- exports.typescriptWithTypes = typescriptWithTypes;
1690
1656
  exports.unicorn = unicorn;
1691
1657
  exports.vue = vue;
1692
1658
  exports.warnUnnecessaryOffRules = warnUnnecessaryOffRules;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import { FlatESLintConfigItem } from 'eslint-define-config';
2
+ import { ParserOptions } from '@typescript-eslint/parser';
3
+ export { default as parserTs } from '@typescript-eslint/parser';
2
4
  import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
3
5
  export { default as pluginComments } from '@eslint-community/eslint-plugin-eslint-comments';
4
6
  export { default as pluginHtml } from '@html-eslint/eslint-plugin';
@@ -6,7 +8,6 @@ export { default as parserHtml } from '@html-eslint/parser';
6
8
  export { default as pluginSo1ve } from '@so1ve/eslint-plugin';
7
9
  export { default as pluginSortImports } from '@so1ve/eslint-plugin-sort-imports';
8
10
  export { default as pluginTs } from '@typescript-eslint/eslint-plugin';
9
- export { default as parserTs } from '@typescript-eslint/parser';
10
11
  export { default as parserMdx } from 'eslint-mdx';
11
12
  export { default as pluginArrayFunc } from 'eslint-plugin-array-func';
12
13
  export { default as pluginEtc } from 'eslint-plugin-etc';
@@ -46,9 +47,11 @@ interface OptionsComponentExts {
46
47
  */
47
48
  componentExts?: string[];
48
49
  }
49
- interface OptionsTypeScriptWithTypes {
50
- tsconfigPath: string;
51
- tsconfigRootDir?: string;
50
+ interface OptionsTypeScriptParserOptions {
51
+ /**
52
+ * Additional parser options for TypeScript.
53
+ */
54
+ parserOptions?: Partial<ParserOptions>;
52
55
  }
53
56
  interface OptionsHasTypeScript {
54
57
  typescript?: boolean;
@@ -73,7 +76,7 @@ interface Options {
73
76
  *
74
77
  * @default auto-detect based on the dependencies
75
78
  */
76
- typescript?: boolean | OptionsTypeScriptWithTypes;
79
+ typescript?: boolean;
77
80
  /**
78
81
  * Enable test support.
79
82
  *
@@ -122,7 +125,6 @@ interface Options {
122
125
  overrides?: {
123
126
  javascript?: FlatESLintConfigItem["rules"];
124
127
  typescript?: FlatESLintConfigItem["rules"];
125
- typescriptWithTypes?: FlatESLintConfigItem["rules"];
126
128
  test?: FlatESLintConfigItem["rules"];
127
129
  vue?: FlatESLintConfigItem["rules"];
128
130
  solid?: FlatESLintConfigItem["rules"];
@@ -157,8 +159,7 @@ declare const test: ({ overrides, }?: OptionsOverrides) => FlatESLintConfigItem[
157
159
 
158
160
  declare const toml: ({ overrides, }?: OptionsOverrides) => FlatESLintConfigItem[];
159
161
 
160
- declare const typescript: ({ componentExts, overrides, }?: OptionsComponentExts & OptionsOverrides) => FlatESLintConfigItem[];
161
- declare const typescriptWithTypes: ({ componentExts, tsconfigPath, tsconfigRootDir, overrides, }: OptionsTypeScriptWithTypes & OptionsComponentExts & OptionsOverrides) => FlatESLintConfigItem[];
162
+ declare function typescript({ componentExts, parserOptions, overrides, }?: OptionsTypeScriptParserOptions & OptionsComponentExts & OptionsOverrides): FlatESLintConfigItem[];
162
163
 
163
164
  declare const unicorn: () => FlatESLintConfigItem[];
164
165
 
@@ -186,13 +187,13 @@ declare const GLOB_JSON = "**/*.json";
186
187
  declare const GLOB_JSON5 = "**/*.json5";
187
188
  declare const GLOB_JSONC = "**/*.jsonc";
188
189
  declare const GLOB_ESLINTRC = "**/.eslintrc";
189
- declare const GLOB_MARKDOWN = "**/*.md?(x)";
190
+ declare const GLOB_MARKDOWN = "**/*.{md,mdx}";
190
191
  declare const GLOB_VUE = "**/*.vue";
191
192
  declare const GLOB_YAML = "**/*.y?(a)ml";
192
193
  declare const GLOB_TOML = "**/*.toml";
193
194
  declare const GLOB_HTML = "**/*.htm?(l)";
194
195
  declare const GLOB_PACKAGEJSON = "**/package.json";
195
- declare const GLOB_MARKDOWN_CODE = "**/*.md?(x)/**/*.?([cm])[jt]s?(x)";
196
+ declare const GLOB_MARKDOWN_CODE = "**/*.{md,mdx}/**/*.?([cm])[jt]s?(x)";
196
197
  declare const GLOB_TESTS: string[];
197
198
  declare const GLOB_ALL_SRC: string[];
198
199
  declare const GLOB_EXCLUDE: string[];
@@ -208,4 +209,4 @@ declare function recordRulesStateConfigs(configs: FlatESLintConfigItem[]): FlatE
208
209
  declare function recordRulesState(rules: FlatESLintConfigItem["rules"]): FlatESLintConfigItem["rules"];
209
210
  declare function warnUnnecessaryOffRules(): void;
210
211
 
211
- export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DTS, GLOB_ESLINTRC, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_PACKAGEJSON, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, Options, OptionsComponentExts, OptionsHasTypeScript, OptionsOverrides, OptionsTypeScriptWithTypes, combine, comments, html, ignores, imports, javascript, jsdoc, jsonc, mdx, node, onlyError, promise, recordRulesState, recordRulesStateConfigs, renameRules, so1ve, solid, sortImports, test, toml, typescript, typescriptWithTypes, unicorn, vue, warnUnnecessaryOffRules, yaml };
212
+ export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DTS, GLOB_ESLINTRC, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_PACKAGEJSON, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, Options, OptionsComponentExts, OptionsHasTypeScript, OptionsOverrides, OptionsTypeScriptParserOptions, combine, comments, html, ignores, imports, javascript, jsdoc, jsonc, mdx, node, onlyError, promise, recordRulesState, recordRulesStateConfigs, renameRules, so1ve, solid, sortImports, test, toml, typescript, unicorn, vue, warnUnnecessaryOffRules, yaml };
package/dist/index.mjs CHANGED
@@ -12,7 +12,6 @@ import pluginTs from '@typescript-eslint/eslint-plugin';
12
12
  export { default as pluginTs } from '@typescript-eslint/eslint-plugin';
13
13
  import parserTs from '@typescript-eslint/parser';
14
14
  export { default as parserTs } from '@typescript-eslint/parser';
15
- import parserMdx from 'eslint-mdx';
16
15
  export { default as parserMdx } from 'eslint-mdx';
17
16
  import pluginArrayFunc from 'eslint-plugin-array-func';
18
17
  export { default as pluginArrayFunc } from 'eslint-plugin-array-func';
@@ -101,7 +100,7 @@ const GLOB_JSON = "**/*.json";
101
100
  const GLOB_JSON5 = "**/*.json5";
102
101
  const GLOB_JSONC = "**/*.jsonc";
103
102
  const GLOB_ESLINTRC = "**/.eslintrc";
104
- const GLOB_MARKDOWN = "**/*.md?(x)";
103
+ const GLOB_MARKDOWN = "**/*.{md,mdx}";
105
104
  const GLOB_VUE = "**/*.vue";
106
105
  const GLOB_YAML = "**/*.y?(a)ml";
107
106
  const GLOB_TOML = "**/*.toml";
@@ -585,7 +584,6 @@ const jsdoc = () => [
585
584
  "jsdoc/multiline-blocks": "error",
586
585
  "jsdoc/no-defaults": "error",
587
586
  "jsdoc/no-multi-asterisks": "error",
588
- "jsdoc/no-types": "error",
589
587
  "jsdoc/require-param-name": "error",
590
588
  "jsdoc/require-property": "error",
591
589
  "jsdoc/require-property-description": "error",
@@ -640,37 +638,20 @@ const mdx = ({
640
638
  overrides
641
639
  } = {}) => [
642
640
  {
643
- plugins: {
644
- mdx: pluginMdx
645
- }
646
- },
647
- {
648
- languageOptions: {
649
- parser: parserMdx
650
- },
651
- settings: {
652
- "mdx/code-blocks": true
653
- },
654
- files: [GLOB_MARKDOWN],
655
- processor: "mdx/remark",
656
- rules: {
657
- "mdx/remark": "warn",
658
- "no-unused-expressions": "error"
659
- }
641
+ ...pluginMdx.flat,
642
+ processor: pluginMdx.createRemarkProcessor({
643
+ lintCodeBlocks: true,
644
+ languageMapper: {}
645
+ })
660
646
  },
661
647
  {
648
+ ...pluginMdx.flatCodeBlocks,
662
649
  files: [
663
- GLOB_MARKDOWN_CODE,
664
- ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
650
+ ...pluginMdx.flatCodeBlocks.files,
651
+ ...componentExts.map((ext) => `${GLOB_MARKDOWN}/*.${ext}`)
665
652
  ],
666
- languageOptions: {
667
- parserOptions: {
668
- ecmaFeatures: {
669
- impliedStrict: true
670
- }
671
- }
672
- },
673
653
  rules: {
654
+ ...pluginMdx.flatCodeBlocks.rules,
674
655
  "html/require-doctype": "off",
675
656
  "ts/no-redeclare": "off",
676
657
  "ts/no-unused-vars": "off",
@@ -872,239 +853,233 @@ function warnUnnecessaryOffRules() {
872
853
  }
873
854
  }
874
855
 
875
- const typescript = ({
856
+ function typescript({
876
857
  componentExts = [],
858
+ parserOptions,
877
859
  overrides
878
- } = {}) => [
879
- {
880
- // Install the plugins without globs, so they can be configured separately.
881
- plugins: {
882
- import: pluginImport,
883
- ts: pluginTs
884
- }
885
- },
886
- {
887
- files: [GLOB_TS, GLOB_TSX, ...componentExts.map((ext) => `**/*.${ext}`)],
888
- languageOptions: {
889
- parser: parserTs,
890
- parserOptions: {
891
- sourceType: "module"
860
+ } = {}) {
861
+ const typeAwareRules = {
862
+ "etc/no-assign-mutated-array": "error",
863
+ "etc/no-deprecated": "warn",
864
+ "etc/no-internal": "error",
865
+ "no-throw-literal": "off",
866
+ "ts/no-throw-literal": "error",
867
+ "no-implied-eval": "off",
868
+ "ts/no-implied-eval": "error",
869
+ "dot-notation": "off",
870
+ "ts/dot-notation": ["error", { allowKeywords: true }],
871
+ "no-void": ["error", { allowAsStatement: true }],
872
+ "ts/await-thenable": "error",
873
+ "ts/no-for-in-array": "error",
874
+ "ts/no-unnecessary-type-assertion": "error",
875
+ "ts/restrict-template-expressions": [
876
+ "error",
877
+ {
878
+ allowAny: true,
879
+ allowNumber: true,
880
+ allowBoolean: true
892
881
  }
893
- },
894
- settings: {
895
- "import/resolver": {
896
- node: { extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"] },
897
- typescript: {
898
- extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"]
899
- }
882
+ ],
883
+ "ts/array-type": ["error", { default: "array", readonly: "array" }],
884
+ "ts/consistent-generic-constructors": "error",
885
+ "ts/consistent-type-exports": "error",
886
+ "ts/consistent-type-assertions": [
887
+ "error",
888
+ { assertionStyle: "as", objectLiteralTypeAssertions: "allow" }
889
+ ],
890
+ "ts/prefer-nullish-coalescing": "error",
891
+ "ts/prefer-optional-chain": "error",
892
+ "ts/prefer-return-this-type": "error",
893
+ "ts/no-unnecessary-type-arguments": "error",
894
+ "ts/non-nullable-type-assertion-style": "error"
895
+ };
896
+ return [
897
+ {
898
+ // Install the plugins without globs, so they can be configured separately.
899
+ plugins: {
900
+ import: pluginImport,
901
+ ts: pluginTs,
902
+ etc: pluginEtc
900
903
  }
901
904
  },
902
- rules: {
903
- ...renameRules(
904
- pluginTs.configs["eslint-recommended"].overrides[0].rules,
905
- "@typescript-eslint/",
906
- "ts/"
907
- ),
908
- ...renameRules(
909
- pluginTs.configs.recommended.rules,
910
- "@typescript-eslint/",
911
- "ts/"
912
- ),
913
- "import/named": "off",
914
- // TS
915
- "ts/comma-dangle": "off",
916
- "ts/brace-style": "off",
917
- "ts/comma-spacing": "off",
918
- "ts/func-call-spacing": "off",
919
- "ts/indent": "off",
920
- "ts/keyword-spacing": "off",
921
- "ts/member-delimiter-style": "off",
922
- "ts/no-extra-parens": "off",
923
- "ts/no-extra-semi": "off",
924
- "ts/quotes": "off",
925
- "ts/semi": "off",
926
- "ts/space-before-function-paren": "off",
927
- "ts/type-annotation-spacing": "off",
928
- "ts/ban-ts-comment": [
929
- "error",
930
- {
931
- minimumDescriptionLength: 0
905
+ {
906
+ files: [GLOB_TS, GLOB_TSX, ...componentExts.map((ext) => `**/*.${ext}`)],
907
+ languageOptions: {
908
+ parser: parserTs,
909
+ parserOptions: {
910
+ sourceType: "module",
911
+ EXPERIMENTAL_useProjectService: true,
912
+ ...parserOptions
932
913
  }
933
- ],
934
- "ts/ban-types": [
935
- "error",
936
- {
937
- extendDefaults: false,
938
- types: {
939
- String: {
940
- message: "Use `string` instead.",
941
- fixWith: "string"
942
- },
943
- Number: {
944
- message: "Use `number` instead.",
945
- fixWith: "number"
946
- },
947
- Boolean: {
948
- message: "Use `boolean` instead.",
949
- fixWith: "boolean"
950
- },
951
- Symbol: {
952
- message: "Use `symbol` instead.",
953
- fixWith: "symbol"
954
- },
955
- BigInt: {
956
- message: "Use `bigint` instead.",
957
- fixWith: "bigint"
958
- },
959
- Object: {
960
- message: "The `Object` type is mostly the same as `unknown`. You probably want `Record<PropertyKey, unknown>` instead. See https://github.com/typescript-eslint/typescript-eslint/pull/848",
961
- fixWith: "Record<PropertyKey, unknown>"
962
- },
963
- object: {
964
- message: "The `object` type is hard to use. Use `Record<PropertyKey, unknown>` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848",
965
- fixWith: "Record<PropertyKey, unknown>"
966
- },
967
- Function: {
968
- message: "Use `(...args: any[]) => any` instead.",
969
- fixWith: "(...args: any[]) => any"
914
+ },
915
+ settings: {
916
+ "import/resolver": {
917
+ node: { extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"] },
918
+ typescript: {
919
+ extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"]
920
+ }
921
+ }
922
+ },
923
+ rules: {
924
+ ...renameRules(
925
+ pluginTs.configs["eslint-recommended"].overrides[0].rules,
926
+ "@typescript-eslint/",
927
+ "ts/"
928
+ ),
929
+ ...renameRules(
930
+ pluginTs.configs.recommended.rules,
931
+ "@typescript-eslint/",
932
+ "ts/"
933
+ ),
934
+ "import/named": "off",
935
+ // TS
936
+ "ts/comma-dangle": "off",
937
+ "ts/brace-style": "off",
938
+ "ts/comma-spacing": "off",
939
+ "ts/func-call-spacing": "off",
940
+ "ts/indent": "off",
941
+ "ts/keyword-spacing": "off",
942
+ "ts/member-delimiter-style": "off",
943
+ "ts/no-extra-parens": "off",
944
+ "ts/no-extra-semi": "off",
945
+ "ts/quotes": "off",
946
+ "ts/semi": "off",
947
+ "ts/space-before-function-paren": "off",
948
+ "ts/type-annotation-spacing": "off",
949
+ "ts/ban-ts-comment": [
950
+ "error",
951
+ {
952
+ minimumDescriptionLength: 0
953
+ }
954
+ ],
955
+ "ts/ban-types": [
956
+ "error",
957
+ {
958
+ extendDefaults: false,
959
+ types: {
960
+ String: {
961
+ message: "Use `string` instead.",
962
+ fixWith: "string"
963
+ },
964
+ Number: {
965
+ message: "Use `number` instead.",
966
+ fixWith: "number"
967
+ },
968
+ Boolean: {
969
+ message: "Use `boolean` instead.",
970
+ fixWith: "boolean"
971
+ },
972
+ Symbol: {
973
+ message: "Use `symbol` instead.",
974
+ fixWith: "symbol"
975
+ },
976
+ BigInt: {
977
+ message: "Use `bigint` instead.",
978
+ fixWith: "bigint"
979
+ },
980
+ Object: {
981
+ message: "The `Object` type is mostly the same as `unknown`. You probably want `Record<PropertyKey, unknown>` instead. See https://github.com/typescript-eslint/typescript-eslint/pull/848",
982
+ fixWith: "Record<PropertyKey, unknown>"
983
+ },
984
+ object: {
985
+ message: "The `object` type is hard to use. Use `Record<PropertyKey, unknown>` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848",
986
+ fixWith: "Record<PropertyKey, unknown>"
987
+ },
988
+ Function: {
989
+ message: "Use `(...args: any[]) => any` instead.",
990
+ fixWith: "(...args: any[]) => any"
991
+ }
970
992
  }
971
993
  }
994
+ ],
995
+ "ts/consistent-type-imports": [
996
+ "error",
997
+ { prefer: "type-imports", disallowTypeAnnotations: false }
998
+ ],
999
+ "ts/consistent-type-definitions": ["error", "interface"],
1000
+ "ts/consistent-indexed-object-style": ["error", "record"],
1001
+ "ts/prefer-ts-expect-error": "error",
1002
+ "ts/no-require-imports": "error",
1003
+ "ts/method-signature-style": ["error", "property"],
1004
+ // Override JS
1005
+ "no-useless-constructor": "off",
1006
+ "no-invalid-this": "off",
1007
+ "ts/no-invalid-this": "error",
1008
+ "no-redeclare": "off",
1009
+ "ts/no-redeclare": "error",
1010
+ "no-use-before-define": "off",
1011
+ "ts/no-use-before-define": [
1012
+ "error",
1013
+ { functions: false, classes: false, variables: true }
1014
+ ],
1015
+ "object-curly-spacing": "off",
1016
+ "space-before-blocks": "off",
1017
+ "ts/space-before-blocks": "off",
1018
+ "space-before-function-paren": "off",
1019
+ "no-dupe-class-members": "off",
1020
+ "ts/no-dupe-class-members": "error",
1021
+ "no-loss-of-precision": "off",
1022
+ "ts/no-loss-of-precision": "error",
1023
+ "lines-between-class-members": "off",
1024
+ "ts/lines-between-class-members": [
1025
+ "error",
1026
+ "always",
1027
+ { exceptAfterSingleLine: true }
1028
+ ],
1029
+ // so1ve
1030
+ "so1ve/no-inline-type-import": "error",
1031
+ // off
1032
+ "ts/camelcase": "off",
1033
+ "ts/explicit-function-return-type": "off",
1034
+ "ts/explicit-member-accessibility": "off",
1035
+ "ts/no-explicit-any": "off",
1036
+ "ts/no-parameter-properties": "off",
1037
+ "ts/no-empty-interface": "off",
1038
+ "ts/ban-ts-ignore": "off",
1039
+ "ts/no-empty-function": "off",
1040
+ "ts/no-non-null-assertion": "off",
1041
+ "ts/explicit-module-boundary-types": "off",
1042
+ "ts/triple-slash-reference": "off",
1043
+ "ts/prefer-for-of": "error",
1044
+ "ts/no-duplicate-enum-values": "error",
1045
+ "ts/no-non-null-asserted-nullish-coalescing": "error",
1046
+ // handled by unused-imports/no-unused-imports
1047
+ "ts/no-unused-vars": "off",
1048
+ ...typeAwareRules,
1049
+ ...overrides
1050
+ }
1051
+ },
1052
+ {
1053
+ files: [GLOB_MARKDOWN_CODE],
1054
+ languageOptions: {
1055
+ parser: parserTs,
1056
+ parserOptions: {
1057
+ sourceType: "module"
972
1058
  }
973
- ],
974
- "ts/consistent-type-imports": [
975
- "error",
976
- { prefer: "type-imports", disallowTypeAnnotations: false }
977
- ],
978
- "ts/consistent-type-definitions": ["error", "interface"],
979
- "ts/consistent-indexed-object-style": ["error", "record"],
980
- "ts/prefer-ts-expect-error": "error",
981
- "ts/no-require-imports": "error",
982
- "ts/method-signature-style": ["error", "property"],
983
- // Override JS
984
- "no-useless-constructor": "off",
985
- "no-invalid-this": "off",
986
- "ts/no-invalid-this": "error",
987
- "no-redeclare": "off",
988
- "ts/no-redeclare": "error",
989
- "no-use-before-define": "off",
990
- "ts/no-use-before-define": [
991
- "error",
992
- { functions: false, classes: false, variables: true }
993
- ],
994
- "object-curly-spacing": "off",
995
- "space-before-blocks": "off",
996
- "ts/space-before-blocks": "off",
997
- "space-before-function-paren": "off",
998
- "no-dupe-class-members": "off",
999
- "ts/no-dupe-class-members": "error",
1000
- "no-loss-of-precision": "off",
1001
- "ts/no-loss-of-precision": "error",
1002
- "lines-between-class-members": "off",
1003
- "ts/lines-between-class-members": [
1004
- "error",
1005
- "always",
1006
- { exceptAfterSingleLine: true }
1007
- ],
1008
- // so1ve
1009
- "so1ve/no-inline-type-import": "error",
1010
- // off
1011
- "ts/camelcase": "off",
1012
- "ts/explicit-function-return-type": "off",
1013
- "ts/explicit-member-accessibility": "off",
1014
- "ts/no-explicit-any": "off",
1015
- "ts/no-parameter-properties": "off",
1016
- "ts/no-empty-interface": "off",
1017
- "ts/ban-ts-ignore": "off",
1018
- "ts/no-empty-function": "off",
1019
- "ts/no-non-null-assertion": "off",
1020
- "ts/explicit-module-boundary-types": "off",
1021
- "ts/triple-slash-reference": "off",
1022
- "ts/prefer-for-of": "error",
1023
- "ts/no-duplicate-enum-values": "error",
1024
- "ts/no-non-null-asserted-nullish-coalescing": "error",
1025
- // handled by unused-imports/no-unused-imports
1026
- "ts/no-unused-vars": "off",
1027
- ...overrides
1028
- }
1029
- },
1030
- {
1031
- files: ["**/*.d.ts"],
1032
- rules: {
1033
- "eslint-comments/no-unlimited-disable": "off",
1034
- "import/no-duplicates": "off",
1035
- "unused-imports/no-unused-vars": "off"
1036
- }
1037
- },
1038
- {
1039
- files: ["**/*.js", "**/*.cjs"],
1040
- rules: {
1041
- "ts/no-require-imports": "off",
1042
- "ts/no-var-requires": "off"
1043
- }
1044
- }
1045
- ];
1046
- const typescriptWithTypes = ({
1047
- componentExts = [],
1048
- tsconfigPath,
1049
- tsconfigRootDir = process.cwd(),
1050
- overrides = {}
1051
- }) => [
1052
- {
1053
- files: [
1054
- GLOB_TS,
1055
- GLOB_TSX,
1056
- ...componentExts.map((ext) => `**/*.${ext}`),
1057
- `!${GLOB_MARKDOWN}/*.*`
1058
- ],
1059
- plugins: {
1060
- etc: pluginEtc
1059
+ },
1060
+ rules: {
1061
+ ...Object.fromEntries(
1062
+ Object.keys(typeAwareRules).map((k) => [k, "off"])
1063
+ )
1064
+ }
1061
1065
  },
1062
- languageOptions: {
1063
- parser: parserTs,
1064
- parserOptions: {
1065
- project: [tsconfigPath],
1066
- tsconfigRootDir,
1067
- EXPERIMENTAL_useProjectService: true
1066
+ {
1067
+ files: ["**/*.d.ts"],
1068
+ rules: {
1069
+ "eslint-comments/no-unlimited-disable": "off",
1070
+ "import/no-duplicates": "off",
1071
+ "unused-imports/no-unused-vars": "off"
1068
1072
  }
1069
1073
  },
1070
- rules: {
1071
- "etc/no-assign-mutated-array": "error",
1072
- "etc/no-deprecated": "warn",
1073
- "etc/no-internal": "error",
1074
- "no-throw-literal": "off",
1075
- "ts/no-throw-literal": "error",
1076
- "no-implied-eval": "off",
1077
- "ts/no-implied-eval": "error",
1078
- "dot-notation": "off",
1079
- "ts/dot-notation": ["error", { allowKeywords: true }],
1080
- "no-void": ["error", { allowAsStatement: true }],
1081
- "ts/await-thenable": "error",
1082
- "ts/no-for-in-array": "error",
1083
- "ts/no-unnecessary-type-assertion": "error",
1084
- "ts/restrict-template-expressions": [
1085
- "error",
1086
- {
1087
- allowAny: true,
1088
- allowNumber: true,
1089
- allowBoolean: true
1090
- }
1091
- ],
1092
- "ts/array-type": ["error", { default: "array", readonly: "array" }],
1093
- "ts/consistent-generic-constructors": "error",
1094
- "ts/consistent-type-exports": "error",
1095
- "ts/consistent-type-assertions": [
1096
- "error",
1097
- { assertionStyle: "as", objectLiteralTypeAssertions: "allow" }
1098
- ],
1099
- "ts/prefer-nullish-coalescing": "error",
1100
- "ts/prefer-optional-chain": "error",
1101
- "ts/prefer-return-this-type": "error",
1102
- "ts/no-unnecessary-type-arguments": "error",
1103
- "ts/non-nullable-type-assertion-style": "error",
1104
- ...overrides
1074
+ {
1075
+ files: ["**/*.js", "**/*.cjs"],
1076
+ rules: {
1077
+ "ts/no-require-imports": "off",
1078
+ "ts/no-var-requires": "off"
1079
+ }
1105
1080
  }
1106
- }
1107
- ];
1081
+ ];
1082
+ }
1108
1083
 
1109
1084
  const unicorn = () => [
1110
1085
  {
@@ -1404,7 +1379,7 @@ function so1ve(options = {}, ...userConfigs) {
1404
1379
  configs.push(
1405
1380
  ignores(),
1406
1381
  javascript({
1407
- // overrides: overrides.javascript,
1382
+ overrides: overrides.javascript
1408
1383
  }),
1409
1384
  comments(),
1410
1385
  node(),
@@ -1423,19 +1398,10 @@ function so1ve(options = {}, ...userConfigs) {
1423
1398
  if (enableTypeScript) {
1424
1399
  configs.push(
1425
1400
  typescript({
1426
- // componentExts,
1427
- // overrides: overrides.typescript,
1401
+ componentExts,
1402
+ overrides: overrides.typescript
1428
1403
  })
1429
1404
  );
1430
- if (typeof enableTypeScript !== "boolean") {
1431
- configs.push(
1432
- typescriptWithTypes({
1433
- ...enableTypeScript,
1434
- componentExts,
1435
- overrides: overrides.typescriptWithTypes
1436
- })
1437
- );
1438
- }
1439
1405
  }
1440
1406
  if ((_a = options.test) != null ? _a : true) {
1441
1407
  configs.push(
@@ -1498,4 +1464,4 @@ function so1ve(options = {}, ...userConfigs) {
1498
1464
  return merged;
1499
1465
  }
1500
1466
 
1501
- export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DTS, GLOB_ESLINTRC, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_PACKAGEJSON, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, combine, comments, html, ignores, imports, javascript, jsdoc, jsonc, mdx, node, onlyError, promise, recordRulesState, recordRulesStateConfigs, renameRules, so1ve, solid, sortImports, test, toml, typescript, typescriptWithTypes, unicorn, vue, warnUnnecessaryOffRules, yaml };
1467
+ export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DTS, GLOB_ESLINTRC, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_PACKAGEJSON, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, combine, comments, html, ignores, imports, javascript, jsdoc, jsonc, mdx, node, onlyError, promise, recordRulesState, recordRulesStateConfigs, renameRules, so1ve, solid, sortImports, test, toml, typescript, unicorn, vue, warnUnnecessaryOffRules, yaml };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@so1ve/eslint-config",
3
- "version": "1.0.0-alpha.2",
3
+ "version": "1.0.0-alpha.4",
4
4
  "author": "Ray <i@mk1.io> (https://github.com/so1ve/)",
5
5
  "description": "Ray's eslint config.",
6
6
  "keywords": [
@@ -71,8 +71,8 @@
71
71
  "toml-eslint-parser": "^0.6.0",
72
72
  "vue-eslint-parser": "^9.3.1",
73
73
  "yaml-eslint-parser": "^1.2.2",
74
- "@so1ve/eslint-plugin-sort-imports": "1.0.0-alpha.2",
75
- "@so1ve/eslint-plugin": "1.0.0-alpha.2"
74
+ "@so1ve/eslint-plugin-sort-imports": "1.0.0-alpha.4",
75
+ "@so1ve/eslint-plugin": "1.0.0-alpha.4"
76
76
  },
77
77
  "devDependencies": {
78
78
  "eslint": "^8.46.0"