@shibanet0/datamitsu-config 0.0.1-alpha-10 → 0.0.1-alpha-11

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 (36) hide show
  1. package/bin/datamitsu.mjs +1 -0
  2. package/datamitsu.js +247 -40
  3. package/dist/chunk-7PGRJISO.js +24 -0
  4. package/dist/dist-SV6KNVWH.js +145 -0
  5. package/dist/eslint/globs.d.ts +16 -0
  6. package/dist/eslint/index.js +869 -261
  7. package/dist/eslint/plugins/arrayFunc.d.ts +2 -0
  8. package/dist/eslint/plugins/deMorgan.d.ts +2 -0
  9. package/dist/eslint/plugins/import.d.ts +2 -2
  10. package/dist/eslint/plugins/javascript.d.ts +2 -0
  11. package/dist/eslint/plugins/jsx-a11y.d.ts +2 -2
  12. package/dist/eslint/plugins/n.d.ts +2 -0
  13. package/dist/eslint/plugins/no-use-extend-native.d.ts +2 -2
  14. package/dist/eslint/plugins/perfectionist.d.ts +2 -2
  15. package/dist/eslint/plugins/promise.d.ts +2 -2
  16. package/dist/eslint/plugins/react-hooks.d.ts +2 -2
  17. package/dist/eslint/plugins/react-perf.d.ts +2 -2
  18. package/dist/eslint/plugins/react-prefer-function-component.d.ts +2 -2
  19. package/dist/eslint/plugins/react-refresh.d.ts +2 -2
  20. package/dist/eslint/plugins/react.d.ts +2 -2
  21. package/dist/eslint/plugins/security.d.ts +2 -2
  22. package/dist/eslint/plugins/sonarjs.d.ts +2 -2
  23. package/dist/eslint/plugins/storybook.d.ts +2 -2
  24. package/dist/eslint/plugins/turbo.d.ts +2 -2
  25. package/dist/eslint/plugins/typescript.d.ts +2 -0
  26. package/dist/eslint/plugins/unicorn.d.ts +2 -2
  27. package/dist/eslint/plugins/unused-imports.d.ts +2 -2
  28. package/dist/eslint/types.d.ts +34 -0
  29. package/dist/globs/globs.d.ts +1 -0
  30. package/dist/oxlint/index.d.ts +2 -0
  31. package/dist/react-QIEZHZI3.js +61 -0
  32. package/dist/storybook-IETULN4Z.js +8 -0
  33. package/dist/turbo-ZBSVFMOO.js +23 -0
  34. package/dist/unused-imports-GCXR6T7K.js +31 -0
  35. package/oxlint_configuration_schema.json +712 -0
  36. package/package.json +11 -3
package/bin/datamitsu.mjs CHANGED
@@ -25,6 +25,7 @@ const child = spawn(
25
25
  DATAMITSU_APP_COMMITLINT_BINARY_FILEPATH: getBinaryFilepath("@commitlint/cli", "../cli.js"),
26
26
  DATAMITSU_APP_ESLINT_BINARY_FILEPATH: getBinaryFilepath("eslint", "../../bin/eslint.js"),
27
27
  DATAMITSU_APP_KNIP_BINARY_FILEPATH: getBinaryFilepath("knip", "../../bin/knip.js"),
28
+ DATAMITSU_APP_OXLINT_BINARY_FILEPATH: getBinaryFilepath("oxlint", "../../bin/oxlint"),
28
29
  DATAMITSU_APP_PRETTIER_BINARY_FILEPATH: getBinaryFilepath("prettier", "../bin/prettier.cjs"),
29
30
  DATAMITSU_APP_SORT_PACKAGE_JSON_BINARY_FILEPATH: getBinaryFilepath(
30
31
  "sort-package-json",
package/datamitsu.js CHANGED
@@ -738,12 +738,8 @@ var mapOfApps = {
738
738
  // },
739
739
  eslint: {
740
740
  shell: {
741
- args: [
742
- facts().env.DATAMITSU_APP_ESLINT_BINARY_FILEPATH || "",
743
- "-c",
744
- tools.Path.join(facts().cwd, "eslint.config.ts")
745
- ],
746
- name: "node"
741
+ args: [],
742
+ name: facts().env.DATAMITSU_APP_ESLINT_BINARY_FILEPATH || ""
747
743
  }
748
744
  },
749
745
  gitleaks: {
@@ -775,6 +771,12 @@ var mapOfApps = {
775
771
  // https://www.npmjs.com/package/@mermaid-js/mermaid-cli
776
772
  pnpm: { packageName: "@mermaid-js/mermaid-cli", version: "11.12.0" }
777
773
  },
774
+ oxlint: {
775
+ shell: {
776
+ args: ["-c", tools.Path.join(facts().cwd, ".oxlintrc.json")],
777
+ name: facts().env.DATAMITSU_APP_OXLINT_BINARY_FILEPATH || ""
778
+ }
779
+ },
778
780
  prettier: {
779
781
  shell: {
780
782
  args: [facts().env.DATAMITSU_APP_PRETTIER_BINARY_FILEPATH || ""],
@@ -863,7 +865,7 @@ var mapOfApps = {
863
865
 
864
866
  // package.json
865
867
  var name = "@shibanet0/datamitsu-config";
866
- var version = "0.0.1-alpha-9";
868
+ var version = "0.0.1-alpha-11";
867
869
  var dependencies = {
868
870
  "@antebudimir/eslint-plugin-vanilla-extract": "1.16.0",
869
871
  "@commitlint/cli": "20.2.0",
@@ -878,13 +880,16 @@ var dependencies = {
878
880
  "conventional-changelog-conventionalcommits": "9.1.0",
879
881
  eslint: "9.39.2",
880
882
  "eslint-config-prettier": "10.1.8",
883
+ "eslint-flat-config-utils": "2.1.4",
881
884
  "eslint-plugin-array-func": "5.1.0",
885
+ "eslint-plugin-de-morgan": "2.0.0",
882
886
  "eslint-plugin-import": "2.32.0",
883
887
  "eslint-plugin-json": "4.0.1",
884
888
  "eslint-plugin-json-schema-validator": "5.5.0",
885
889
  "eslint-plugin-jsx-a11y": "6.10.2",
886
890
  "eslint-plugin-n": "17.23.1",
887
891
  "eslint-plugin-no-use-extend-native": "0.7.2",
892
+ "eslint-plugin-oxlint": "1.34.0",
888
893
  "eslint-plugin-perfectionist": "4.15.1",
889
894
  "eslint-plugin-playwright": "2.4.0",
890
895
  "eslint-plugin-promise": "7.2.1",
@@ -893,16 +898,18 @@ var dependencies = {
893
898
  "eslint-plugin-react-perf": "3.3.3",
894
899
  "eslint-plugin-react-prefer-function-component": "5.0.0",
895
900
  "eslint-plugin-react-refresh": "0.4.26",
901
+ "eslint-plugin-regexp": "2.10.0",
896
902
  "eslint-plugin-security": "3.0.1",
897
903
  "eslint-plugin-sonarjs": "3.0.5",
898
904
  "eslint-plugin-storybook": "10.1.10",
899
905
  "eslint-plugin-toml": "0.12.0",
900
906
  "eslint-plugin-turbo": "2.6.3",
901
907
  "eslint-plugin-unicorn": "62.0.0",
902
- "eslint-plugin-unused-imports": "4.3.0",
903
908
  "eslint-plugin-yaml": "1.1.3",
904
909
  "eslint-plugin-yml": "1.19.1",
910
+ globals: "16.5.0",
905
911
  knip: "5.75.1",
912
+ oxlint: "1.34.0",
906
913
  prettier: "3.7.4",
907
914
  "prettier-plugin-embed": "0.5.0",
908
915
  "prettier-plugin-jsdoc": "1.8.0",
@@ -913,9 +920,162 @@ var dependencies = {
913
920
  tsup: "8.5.1",
914
921
  tsx: "4.21.0",
915
922
  "type-fest": "5.3.1",
923
+ typescript: "5.9.3",
916
924
  "typescript-eslint": "8.50.0"
917
925
  };
918
926
 
927
+ // src/oxlint/index.ts
928
+ var disabledRules = {
929
+ "no-unsafe-optional-chaining": "off",
930
+ "no-unused-vars": "off",
931
+ "no-useless-rename": "off",
932
+ "typescript/triple-slash-reference": "off",
933
+ "unicorn/no-single-promise-in-promise-methods": "off"
934
+ };
935
+ var oxlintConfig = {
936
+ $schema: `./node_modules/${name}/oxlint_configuration_schema.json`,
937
+ categories: {},
938
+ env: {
939
+ builtin: true
940
+ },
941
+ globals: {},
942
+ ignorePatterns: [],
943
+ plugins: ["unicorn", "typescript", "oxc"],
944
+ rules: {
945
+ "constructor-super": "warn",
946
+ "for-direction": "warn",
947
+ "no-async-promise-executor": "warn",
948
+ "no-caller": "warn",
949
+ "no-class-assign": "warn",
950
+ "no-compare-neg-zero": "warn",
951
+ "no-cond-assign": "warn",
952
+ "no-const-assign": "warn",
953
+ "no-constant-binary-expression": "warn",
954
+ "no-constant-condition": "warn",
955
+ "no-control-regex": "warn",
956
+ "no-debugger": "warn",
957
+ "no-delete-var": "warn",
958
+ "no-dupe-class-members": "warn",
959
+ "no-dupe-else-if": "warn",
960
+ "no-dupe-keys": "warn",
961
+ "no-duplicate-case": "warn",
962
+ "no-empty-character-class": "warn",
963
+ "no-empty-pattern": "warn",
964
+ "no-empty-static-block": "warn",
965
+ "no-eval": "warn",
966
+ "no-ex-assign": "warn",
967
+ "no-extra-boolean-cast": "warn",
968
+ "no-func-assign": "warn",
969
+ "no-global-assign": "warn",
970
+ "no-import-assign": "warn",
971
+ "no-invalid-regexp": "warn",
972
+ "no-irregular-whitespace": "warn",
973
+ "no-loss-of-precision": "warn",
974
+ "no-new-native-nonconstructor": "warn",
975
+ "no-nonoctal-decimal-escape": "warn",
976
+ "no-obj-calls": "warn",
977
+ "no-self-assign": "warn",
978
+ "no-setter-return": "warn",
979
+ "no-shadow-restricted-names": "warn",
980
+ "no-sparse-arrays": "warn",
981
+ "no-this-before-super": "warn",
982
+ "no-unassigned-vars": "warn",
983
+ "no-unsafe-finally": "warn",
984
+ "no-unsafe-negation": "warn",
985
+ "no-unsafe-optional-chaining": "warn",
986
+ "no-unused-expressions": "warn",
987
+ "no-unused-labels": "warn",
988
+ "no-unused-private-class-members": "warn",
989
+ "no-unused-vars": "warn",
990
+ "no-useless-backreference": "warn",
991
+ "no-useless-catch": "warn",
992
+ "no-useless-escape": "warn",
993
+ "no-useless-rename": "warn",
994
+ "no-with": "warn",
995
+ "oxc/bad-array-method-on-arguments": "warn",
996
+ "oxc/bad-char-at-comparison": "warn",
997
+ "oxc/bad-comparison-sequence": "warn",
998
+ "oxc/bad-min-max-func": "warn",
999
+ "oxc/bad-object-literal-comparison": "warn",
1000
+ "oxc/bad-replace-all-arg": "warn",
1001
+ "oxc/const-comparisons": "warn",
1002
+ "oxc/double-comparisons": "warn",
1003
+ "oxc/erasing-op": "warn",
1004
+ "oxc/missing-throw": "warn",
1005
+ "oxc/number-arg-out-of-range": "warn",
1006
+ "oxc/only-used-in-recursion": "warn",
1007
+ "oxc/uninvoked-array-callback": "warn",
1008
+ "require-yield": "warn",
1009
+ "typescript/await-thenable": "warn",
1010
+ "typescript/no-array-delete": "warn",
1011
+ "typescript/no-base-to-string": "warn",
1012
+ "typescript/no-duplicate-enum-values": "warn",
1013
+ "typescript/no-duplicate-type-constituents": "warn",
1014
+ "typescript/no-extra-non-null-assertion": "warn",
1015
+ "typescript/no-floating-promises": "warn",
1016
+ "typescript/no-for-in-array": "warn",
1017
+ "typescript/no-implied-eval": "warn",
1018
+ "typescript/no-meaningless-void-operator": "warn",
1019
+ "typescript/no-misused-new": "warn",
1020
+ "typescript/no-misused-spread": "warn",
1021
+ "typescript/no-non-null-asserted-optional-chain": "warn",
1022
+ "typescript/no-redundant-type-constituents": "warn",
1023
+ "typescript/no-this-alias": "warn",
1024
+ "typescript/no-unnecessary-parameter-property-assignment": "warn",
1025
+ "typescript/no-unsafe-declaration-merging": "warn",
1026
+ "typescript/no-unsafe-unary-minus": "warn",
1027
+ "typescript/no-useless-empty-export": "warn",
1028
+ "typescript/no-wrapper-object-types": "warn",
1029
+ "typescript/prefer-as-const": "warn",
1030
+ "typescript/require-array-sort-compare": "warn",
1031
+ "typescript/restrict-template-expressions": "warn",
1032
+ "typescript/unbound-method": "warn",
1033
+ "unicorn/no-await-in-promise-methods": "warn",
1034
+ "unicorn/no-empty-file": "warn",
1035
+ "unicorn/no-invalid-fetch-options": "warn",
1036
+ "unicorn/no-invalid-remove-event-listener": "warn",
1037
+ "unicorn/no-new-array": "warn",
1038
+ "unicorn/no-single-promise-in-promise-methods": "warn",
1039
+ "unicorn/no-thenable": "warn",
1040
+ "unicorn/no-unnecessary-await": "warn",
1041
+ "unicorn/no-useless-fallback-in-spread": "warn",
1042
+ "unicorn/no-useless-length-check": "warn",
1043
+ "unicorn/no-useless-spread": "warn",
1044
+ "unicorn/prefer-set-size": "warn",
1045
+ "unicorn/prefer-string-starts-ends-with": "warn",
1046
+ "use-isnan": "warn",
1047
+ "valid-typeof": "warn",
1048
+ ...disabledRules
1049
+ },
1050
+ settings: {
1051
+ jsdoc: {
1052
+ augmentsExtendsReplacesDocs: false,
1053
+ exemptDestructuredRootsFromChecks: false,
1054
+ ignoreInternal: false,
1055
+ ignorePrivate: false,
1056
+ ignoreReplacesDocs: true,
1057
+ implementsReplacesDocs: false,
1058
+ overrideReplacesDocs: true,
1059
+ tagNamePreference: {}
1060
+ },
1061
+ "jsx-a11y": {
1062
+ attributes: {},
1063
+ components: {},
1064
+ polymorphicPropName: null
1065
+ },
1066
+ next: {
1067
+ rootDir: []
1068
+ },
1069
+ react: {
1070
+ formComponents: [],
1071
+ linkComponents: []
1072
+ },
1073
+ vitest: {
1074
+ typecheck: false
1075
+ }
1076
+ }
1077
+ };
1078
+
919
1079
  // src/datamitsu-config/env.ts
920
1080
  var env = () => {
921
1081
  const _env = facts().env;
@@ -1116,6 +1276,12 @@ var init = {
1116
1276
  projectTypes: ["npm-package"],
1117
1277
  rootOnly: true
1118
1278
  },
1279
+ ".oxlintrc.json": {
1280
+ content: () => {
1281
+ return JSON.stringify(oxlintConfig, null, 2) + "\n";
1282
+ },
1283
+ projectTypes: ["npm-package"]
1284
+ },
1119
1285
  // ".editorconfig": {
1120
1286
  // content: (context) => {
1121
1287
  // // https://editorconfig.org
@@ -1669,10 +1835,6 @@ var projectTypes = {
1669
1835
  description: "Node.js/npm project",
1670
1836
  markers: ["package.json"]
1671
1837
  },
1672
- "typescript-project": {
1673
- description: "",
1674
- markers: ["tsconfig.json"]
1675
- },
1676
1838
  "pnpm-package": {
1677
1839
  description: "pnpm project",
1678
1840
  markers: ["pnpm-lock.yaml"]
@@ -1681,6 +1843,10 @@ var projectTypes = {
1681
1843
  description: "Terraform infrastructure",
1682
1844
  markers: ["*.tf"]
1683
1845
  },
1846
+ "typescript-project": {
1847
+ description: "",
1848
+ markers: ["tsconfig.json"]
1849
+ },
1684
1850
  "typst-project": {
1685
1851
  description: "Typst document",
1686
1852
  markers: ["*.typ"]
@@ -1718,40 +1884,77 @@ var eslintGlobs = [
1718
1884
  "**/*.cts",
1719
1885
  "**/*.tsx"
1720
1886
  ];
1887
+ var oxlintGlobs = [
1888
+ "**/*.js",
1889
+ "**/*.mjs",
1890
+ "**/*.cjs",
1891
+ "**/*.ts",
1892
+ "**/*.mts",
1893
+ "**/*.cts",
1894
+ "**/*.tsx",
1895
+ "**/*.jsx",
1896
+ "**/*.vue",
1897
+ "**/*.astro",
1898
+ "**/*.svelte"
1899
+ ];
1900
+ var _toolPriority = [
1901
+ "oxlint",
1902
+ "eslint",
1903
+ "prettier",
1904
+ "sort-package-json",
1905
+ "tsc",
1906
+ "typstyle"
1907
+ ];
1908
+ var toolPriority = [...new Set(_toolPriority)].reduce(
1909
+ (acc, el, i) => {
1910
+ acc[el] = i;
1911
+ return acc;
1912
+ },
1913
+ {}
1914
+ );
1721
1915
  var toolsConfig = {
1722
1916
  eslint: {
1723
1917
  name: "Eslint",
1724
1918
  operations: {
1725
1919
  fix: {
1726
1920
  args: [
1727
- "--report-unused-inline-configs",
1728
- "0",
1729
- "--report-unused-disable-directives-severity",
1730
- "0",
1731
1921
  "--fix",
1732
- "--quiet",
1733
- "--config",
1734
- tools.Path.join(facts().cwd, "eslint.config.js"),
1922
+ "-c",
1923
+ "{cwd}/eslint.config.js",
1924
+ // "--quiet",
1735
1925
  "{files}"
1736
1926
  ],
1737
1927
  command: "eslint",
1738
1928
  globs: eslintGlobs,
1739
1929
  mode: "batch",
1740
- priority: 0
1930
+ priority: toolPriority.eslint
1741
1931
  },
1742
1932
  lint: {
1743
- args: [
1744
- "--report-unused-inline-configs",
1745
- "0",
1746
- "--report-unused-disable-directives-severity",
1747
- "0",
1748
- "--config",
1749
- tools.Path.join(facts().cwd, "eslint.config.js"),
1750
- "{files}"
1751
- ],
1933
+ args: ["{files}"],
1752
1934
  command: "eslint",
1753
1935
  globs: eslintGlobs,
1754
- mode: "batch"
1936
+ mode: "batch",
1937
+ priority: toolPriority.eslint
1938
+ }
1939
+ },
1940
+ projectTypes: ["npm-package", "typescript-project"]
1941
+ },
1942
+ oxlint: {
1943
+ name: "Oxlint",
1944
+ operations: {
1945
+ fix: {
1946
+ args: ["--fix", "{files}"],
1947
+ command: "oxlint",
1948
+ globs: oxlintGlobs,
1949
+ mode: "batch",
1950
+ priority: toolPriority.oxlint
1951
+ },
1952
+ lint: {
1953
+ args: ["{files}"],
1954
+ command: "oxlint",
1955
+ globs: oxlintGlobs,
1956
+ mode: "batch",
1957
+ priority: toolPriority.oxlint
1755
1958
  }
1756
1959
  },
1757
1960
  projectTypes: ["npm-package", "typescript-project"]
@@ -1809,25 +2012,28 @@ var toolsConfig = {
1809
2012
  "-u",
1810
2013
  "--write",
1811
2014
  "--config",
1812
- tools.Path.join(facts().cwd, "prettier.config.js"),
2015
+ tools.Path.join(facts().gitRoot, "prettier.config.js"),
1813
2016
  "{files}"
1814
2017
  ],
1815
2018
  command: "prettier",
1816
2019
  globs: prettierGlobs,
2020
+ // globs: [],
1817
2021
  mode: "batch",
1818
- priority: 1
2022
+ priority: toolPriority.prettier
1819
2023
  },
1820
2024
  lint: {
1821
2025
  args: [
1822
2026
  "-u",
1823
2027
  "--check",
1824
2028
  "--config",
1825
- tools.Path.join(facts().cwd, "prettier.config.js"),
2029
+ tools.Path.join(facts().gitRoot, "prettier.config.js"),
1826
2030
  "{files}"
1827
2031
  ],
1828
2032
  command: "prettier",
1829
2033
  globs: prettierGlobs,
1830
- mode: "batch"
2034
+ // globs:[],
2035
+ mode: "batch",
2036
+ priority: toolPriority.prettier
1831
2037
  }
1832
2038
  },
1833
2039
  projectTypes: ["npm-package", "typescript-project"]
@@ -1880,14 +2086,14 @@ var toolsConfig = {
1880
2086
  command: "sort-package-json",
1881
2087
  globs: ["**/package.json"],
1882
2088
  mode: "whole-project",
1883
- priority: 200
2089
+ priority: toolPriority["sort-package-json"]
1884
2090
  },
1885
2091
  lint: {
1886
2092
  args: ["--check", "--quiet"],
1887
2093
  command: "sort-package-json",
1888
2094
  globs: ["**/package.json"],
1889
2095
  mode: "whole-project",
1890
- priority: 200
2096
+ priority: toolPriority["sort-package-json"]
1891
2097
  }
1892
2098
  },
1893
2099
  projectTypes: ["npm-package", "typescript-project"]
@@ -1920,7 +2126,7 @@ var toolsConfig = {
1920
2126
  command: "tsc",
1921
2127
  globs: ["**/*.d.ts", "**/*.ts", "**/*.mts", "**/*.cts", "**/*.tsx"],
1922
2128
  mode: "whole-project",
1923
- priority: 200
2129
+ priority: toolPriority.tsc
1924
2130
  }
1925
2131
  },
1926
2132
  projectTypes: ["typescript-project"]
@@ -1953,7 +2159,7 @@ var toolsConfig = {
1953
2159
  command: "typstyle",
1954
2160
  globs: ["**/*.typ"],
1955
2161
  mode: "per-file",
1956
- priority: 0
2162
+ priority: toolPriority.typstyle
1957
2163
  },
1958
2164
  lint: {
1959
2165
  args: [
@@ -1967,14 +2173,15 @@ var toolsConfig = {
1967
2173
  ],
1968
2174
  command: "typstyle",
1969
2175
  globs: ["**/*.typ"],
1970
- mode: "per-file"
2176
+ mode: "per-file",
2177
+ priority: toolPriority.typstyle
1971
2178
  }
1972
2179
  }
1973
2180
  }
1974
2181
  };
1975
2182
 
1976
2183
  // src/datamitsu-config/main.ts
1977
- function getConfig(config) {
2184
+ function getConfig() {
1978
2185
  const configOutput = {
1979
2186
  // ...config,
1980
2187
  apps: {
@@ -0,0 +1,24 @@
1
+ // src/eslint/plugins/storybook.ts
2
+ import "@eslint/config-helpers";
3
+ import "eslint-plugin-storybook";
4
+ var storybookRules = storybook.configs["flat/recommended"];
5
+ async function storybook() {
6
+ const plugin = await import("eslint-plugin-storybook");
7
+ console.log(">>>>", plugin.default.configs["flat/recommended"]);
8
+ return [
9
+ // {
10
+ // name: "shibanet0/storybook/rules",
11
+ // plugins: {
12
+ // storybook: plugin.default,
13
+ // },
14
+ // rules: {
15
+ // ...plugin.default.configs["flat/recommended"].map(el=>el.rules),
16
+ // },
17
+ // },
18
+ ];
19
+ }
20
+
21
+ export {
22
+ storybookRules,
23
+ storybook
24
+ };
@@ -0,0 +1,145 @@
1
+ // ../../../../Library/pnpm/store/v10/links/eslint-plugin-unused-imports/4.3.0/a3da1d10a18945ddc6e862b5d66008b63149462a15f7eaa5392918a3262b9e2b/node_modules/eslint-plugin-unused-imports/dist/index.mjs
2
+ import { createRequire } from "module";
3
+ var commaFilter = { filter: (token) => token.value === "," };
4
+ var includeCommentsFilter = { includeComments: true };
5
+ function isUsedInJSDoc(identifierName, sourceCode) {
6
+ const comments = sourceCode.getAllComments();
7
+ const jsdocPattern = new RegExp(
8
+ // {@link Name} or @see Name
9
+ `(?:@(?:link|linkcode|linkplain|see)\\s+${identifierName}\\b)|(?:\\{@(?:link|linkcode|linkplain)\\s+${identifierName}\\b\\})|(?:[@{](?:type|typedef|param|returns?|template|augments|extends|implements)\\s+[^}]*\\b${identifierName}\\b)`
10
+ );
11
+ return comments.some((comment) => {
12
+ if (comment.type !== "Block") {
13
+ return false;
14
+ }
15
+ return jsdocPattern.test(comment.value);
16
+ });
17
+ }
18
+ function makePredicate(isImport, addFixer) {
19
+ return (problem, context) => {
20
+ const sourceCode = context.sourceCode || context.getSourceCode();
21
+ const node = problem.node ?? // typescript-eslint >= 7.8 sets a range instead of a node
22
+ sourceCode.getNodeByRangeIndex(sourceCode.getIndexFromLoc(problem.loc.start));
23
+ const { parent } = node;
24
+ if (parent && /^Import(|Default|Namespace)Specifier$/.test(parent.type) && isImport) {
25
+ const identifierName = node.name;
26
+ if (identifierName && isUsedInJSDoc(identifierName, sourceCode)) {
27
+ return false;
28
+ }
29
+ }
30
+ return parent ? /^Import(|Default|Namespace)Specifier$/.test(parent.type) == isImport ? Object.assign(problem, addFixer?.(parent, sourceCode)) : false : isImport ? false : problem;
31
+ };
32
+ }
33
+ var unusedVarsPredicate = makePredicate(false);
34
+ var unusedImportsPredicate = makePredicate(true, (parent, sourceCode) => ({
35
+ fix(fixer) {
36
+ const grandParent = parent.parent;
37
+ if (!grandParent) {
38
+ return null;
39
+ }
40
+ if (grandParent.specifiers.length === 1) {
41
+ const nextToken = sourceCode.getTokenAfter(grandParent, includeCommentsFilter);
42
+ const newLinesBetween = nextToken ? nextToken.loc.start.line - grandParent.loc.start.line : 0;
43
+ const endOfReplaceRange = nextToken ? nextToken.range[0] : grandParent.range[1];
44
+ const count = Math.max(0, newLinesBetween - 1);
45
+ return [
46
+ fixer.remove(grandParent),
47
+ fixer.replaceTextRange(
48
+ [grandParent.range[1], endOfReplaceRange],
49
+ "\n".repeat(count)
50
+ )
51
+ ];
52
+ }
53
+ if (parent !== grandParent.specifiers[grandParent.specifiers.length - 1]) {
54
+ const comma = sourceCode.getTokenAfter(parent, commaFilter);
55
+ const prevNode = sourceCode.getTokenBefore(parent);
56
+ return [
57
+ fixer.removeRange([prevNode.range[1], parent.range[0]]),
58
+ fixer.remove(parent),
59
+ fixer.remove(comma)
60
+ ];
61
+ }
62
+ if (grandParent.specifiers.filter((specifier) => specifier.type === "ImportSpecifier").length === 1) {
63
+ const start = sourceCode.getTokenBefore(parent, commaFilter);
64
+ const end = sourceCode.getTokenAfter(parent, {
65
+ filter: (token) => token.value === "}"
66
+ });
67
+ return fixer.removeRange([start.range[0], end.range[1]]);
68
+ }
69
+ return fixer.removeRange([
70
+ sourceCode.getTokenBefore(parent, commaFilter).range[0],
71
+ parent.range[1]
72
+ ]);
73
+ }
74
+ }));
75
+ function createRuleWithPredicate(name, baseRule, predicate) {
76
+ return {
77
+ ...baseRule,
78
+ meta: {
79
+ ...baseRule.meta,
80
+ fixable: "code",
81
+ docs: {
82
+ ...baseRule.meta?.docs,
83
+ url: `https://github.com/sweepline/eslint-plugin-unused-imports/blob/master/docs/rules/${name}.md`
84
+ }
85
+ },
86
+ create(context) {
87
+ return baseRule.create(
88
+ Object.create(context, {
89
+ report: {
90
+ enumerable: true,
91
+ value(problem) {
92
+ const result = predicate(problem, context);
93
+ if (result) {
94
+ context.report(result);
95
+ }
96
+ }
97
+ }
98
+ })
99
+ );
100
+ }
101
+ };
102
+ }
103
+ var rule;
104
+ var require2 = createRequire(import.meta.url);
105
+ function getBaseRule() {
106
+ if (!rule) {
107
+ rule = getRuleFromTSLintPlugin() ?? getRuleFromTSLint() ?? getESLintBaseRule();
108
+ }
109
+ return rule;
110
+ }
111
+ function getRuleFromTSLintPlugin() {
112
+ try {
113
+ const tslintPlugin = require2("@typescript-eslint/eslint-plugin");
114
+ return tslintPlugin.rules["no-unused-vars"];
115
+ } catch (_) {
116
+ return null;
117
+ }
118
+ }
119
+ function getRuleFromTSLint() {
120
+ try {
121
+ const tslint = require2("typescript-eslint");
122
+ return tslint.plugin.rules["no-unused-vars"];
123
+ } catch (_) {
124
+ return null;
125
+ }
126
+ }
127
+ function getESLintBaseRule() {
128
+ const eslint = require2("eslint");
129
+ return new eslint.Linter({ configType: "eslintrc" }).getRules().get("no-unused-vars");
130
+ }
131
+ var no_unused_vars_default = createRuleWithPredicate("no-unused-vars", getBaseRule(), unusedVarsPredicate);
132
+ var no_unused_imports_default = createRuleWithPredicate("no-unused-imports", getBaseRule(), unusedImportsPredicate);
133
+ var plugin = {
134
+ meta: {
135
+ name: "unused-imports"
136
+ },
137
+ rules: {
138
+ "no-unused-vars": no_unused_vars_default,
139
+ "no-unused-imports": no_unused_imports_default
140
+ }
141
+ };
142
+ var index_default = plugin;
143
+ export {
144
+ index_default as default
145
+ };
@@ -0,0 +1,16 @@
1
+ export declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
2
+ export declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
3
+ export declare const GLOB_JS = "**/*.?([cm])js";
4
+ export declare const GLOB_JSX = "**/*.?([cm])jsx";
5
+ export declare const GLOB_TS = "**/*.?([cm])ts";
6
+ export declare const GLOB_TSX = "**/*.?([cm])tsx";
7
+ export declare const GLOB_STYLE = "**/*.{c,le,sc}ss";
8
+ export declare const GLOB_CSS = "**/*.css";
9
+ export declare const GLOB_POSTCSS = "**/*.{p,post}css";
10
+ export declare const GLOB_LESS = "**/*.less";
11
+ export declare const GLOB_SCSS = "**/*.scss";
12
+ export declare const GLOB_JSON = "**/*.json";
13
+ export declare const GLOB_JSON5 = "**/*.json5";
14
+ export declare const GLOB_JSONC = "**/*.jsonc";
15
+ export declare const GLOB_ALL_SRC: string[];
16
+ export declare const GLOB_EXCLUDE: string[];