@isentinel/eslint-config 0.4.0 → 0.5.0

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
@@ -40,9 +40,9 @@ var init_cjs_shims = __esm({
40
40
  }
41
41
  });
42
42
 
43
- // node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.1.1/node_modules/eslint-plugin-simple-import-sort/shared.js
43
+ // node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.3.0/node_modules/eslint-plugin-simple-import-sort/shared.js
44
44
  var require_shared = __commonJS({
45
- "node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.1.1/node_modules/eslint-plugin-simple-import-sort/shared.js"(exports2, module2) {
45
+ "node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.3.0/node_modules/eslint-plugin-simple-import-sort/shared.js"(exports2, module2) {
46
46
  "use strict";
47
47
  init_cjs_shims();
48
48
  function extractChunks(parentNode, isPartOfChunk) {
@@ -581,9 +581,9 @@ var require_shared = __commonJS({
581
581
  }
582
582
  });
583
583
 
584
- // node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.1.1/node_modules/eslint-plugin-simple-import-sort/imports.js
584
+ // node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.3.0/node_modules/eslint-plugin-simple-import-sort/imports.js
585
585
  var require_imports = __commonJS({
586
- "node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.1.1/node_modules/eslint-plugin-simple-import-sort/imports.js"(exports2, module2) {
586
+ "node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.3.0/node_modules/eslint-plugin-simple-import-sort/imports.js"(exports2, module2) {
587
587
  "use strict";
588
588
  init_cjs_shims();
589
589
  var shared = require_shared();
@@ -708,9 +708,9 @@ var require_imports = __commonJS({
708
708
  }
709
709
  });
710
710
 
711
- // node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.1.1/node_modules/eslint-plugin-simple-import-sort/exports.js
711
+ // node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.3.0/node_modules/eslint-plugin-simple-import-sort/exports.js
712
712
  var require_exports = __commonJS({
713
- "node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.1.1/node_modules/eslint-plugin-simple-import-sort/exports.js"(exports2, module2) {
713
+ "node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.3.0/node_modules/eslint-plugin-simple-import-sort/exports.js"(exports2, module2) {
714
714
  "use strict";
715
715
  init_cjs_shims();
716
716
  var shared = require_shared();
@@ -799,9 +799,9 @@ var require_exports = __commonJS({
799
799
  }
800
800
  });
801
801
 
802
- // node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.1.1/node_modules/eslint-plugin-simple-import-sort/index.js
802
+ // node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.3.0/node_modules/eslint-plugin-simple-import-sort/index.js
803
803
  var require_eslint_plugin_simple_import_sort = __commonJS({
804
- "node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.1.1/node_modules/eslint-plugin-simple-import-sort/index.js"(exports2, module2) {
804
+ "node_modules/.pnpm/eslint-plugin-simple-import-sort@12.1.0_eslint@9.3.0/node_modules/eslint-plugin-simple-import-sort/index.js"(exports2, module2) {
805
805
  "use strict";
806
806
  init_cjs_shims();
807
807
  var importsRule = require_imports();
@@ -897,11 +897,11 @@ var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
897
897
  var import_eslint_plugin_no_autofix = __toESM(require("eslint-plugin-no-autofix"), 1);
898
898
  var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
899
899
  var import_eslint_plugin_promise = __toESM(require("eslint-plugin-promise"), 1);
900
- var import_eslint_plugin_roblox_ts = __toESM(require("eslint-plugin-roblox-ts"), 1);
901
900
  var import_eslint_plugin_simple_import_sort = __toESM(require_eslint_plugin_simple_import_sort(), 1);
902
901
  var pluginSonar = __toESM(require("eslint-plugin-sonarjs"), 1);
903
902
  var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
904
903
  var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
904
+ var import_isentinel_eslint_plugin_roblox_ts = __toESM(require("isentinel-eslint-plugin-roblox-ts"), 1);
905
905
 
906
906
  // src/configs/comments.ts
907
907
  async function comments() {
@@ -1006,11 +1006,13 @@ async function combine(...configs) {
1006
1006
  const resolved = await Promise.all(configs);
1007
1007
  return resolved.flat();
1008
1008
  }
1009
- function renameRules(rules, from, to) {
1009
+ function renameRules(rules, map) {
1010
1010
  return Object.fromEntries(
1011
1011
  Object.entries(rules).map(([key, value]) => {
1012
- if (key.startsWith(from)) {
1013
- return [to + key.slice(from.length), value];
1012
+ for (const [from, to] of Object.entries(map)) {
1013
+ if (key.startsWith(`${from}/`)) {
1014
+ return [to + key.slice(from.length), value];
1015
+ }
1014
1016
  }
1015
1017
  return [key, value];
1016
1018
  })
@@ -1627,23 +1629,23 @@ async function perfectionist() {
1627
1629
 
1628
1630
  // src/configs/prettier.ts
1629
1631
  init_cjs_shims();
1630
- async function prettier(options = {}) {
1631
- const { componentExts: componentExtensions = [] } = options;
1632
- const files = options.files ?? [
1632
+ async function prettier(options) {
1633
+ const {
1634
+ componentExts: componentExtensions = [],
1635
+ files: prettierFiles,
1636
+ prettierOptions
1637
+ } = options ?? {};
1638
+ const files = prettierFiles ?? [
1633
1639
  GLOB_SRC,
1634
1640
  ...componentExtensions.map((extension) => `**/*.${extension}`)
1635
1641
  ];
1636
- const prettierOptions = {
1642
+ const defaultPrettierOptions = prettierOptions ?? {
1637
1643
  arrowParens: "avoid",
1638
- jsdocPreferCodeFences: true,
1639
- jsdocPrintWidth: 80,
1640
- plugins: ["prettier-plugin-jsdoc"],
1641
- printWidth: 100,
1644
+ printWidth: 120,
1642
1645
  semi: true,
1643
1646
  singleQuote: false,
1644
1647
  tabWidth: 4,
1645
1648
  trailingComma: "all",
1646
- tsdoc: true,
1647
1649
  useTabs: true
1648
1650
  };
1649
1651
  return [
@@ -1659,7 +1661,7 @@ async function prettier(options = {}) {
1659
1661
  "format/prettier": [
1660
1662
  "error",
1661
1663
  {
1662
- ...prettierOptions,
1664
+ ...defaultPrettierOptions,
1663
1665
  parser: "typescript"
1664
1666
  }
1665
1667
  ],
@@ -1760,12 +1762,13 @@ async function prettier(options = {}) {
1760
1762
 
1761
1763
  // src/configs/promise.ts
1762
1764
  init_cjs_shims();
1765
+ var import_compat = require("@eslint/compat");
1763
1766
  async function promise() {
1764
1767
  return [
1765
1768
  {
1766
1769
  name: "style:promise",
1767
1770
  plugins: {
1768
- promise: import_eslint_plugin_promise.default
1771
+ promise: (0, import_compat.fixupPluginRules)(import_eslint_plugin_promise.default)
1769
1772
  },
1770
1773
  rules: {
1771
1774
  "promise/always-return": [
@@ -1785,11 +1788,11 @@ async function promise() {
1785
1788
  "promise/no-callback-in-promise": "off",
1786
1789
  "promise/no-multiple-resolved": "warn",
1787
1790
  "promise/no-native": "off",
1788
- // "promise/no-nesting": "warn",
1791
+ "promise/no-nesting": "warn",
1789
1792
  "promise/no-new-statics": "off",
1790
- // "promise/no-promise-in-callback": "warn",
1793
+ "promise/no-promise-in-callback": "warn",
1791
1794
  "promise/no-return-in-finally": "warn",
1792
- // "promise/no-return-wrap": "error",
1795
+ "promise/no-return-wrap": "error",
1793
1796
  "promise/param-names": "warn",
1794
1797
  "promise/prefer-await-to-callbacks": "off",
1795
1798
  "promise/prefer-await-to-then": "off"
@@ -1800,8 +1803,9 @@ async function promise() {
1800
1803
 
1801
1804
  // src/configs/react.ts
1802
1805
  init_cjs_shims();
1806
+ var import_compat2 = require("@eslint/compat");
1803
1807
  async function react(options = {}) {
1804
- const { files = [GLOB_JSX, GLOB_TSX], overrides = {} } = options;
1808
+ const { files = [GLOB_TS, GLOB_TSX], overrides = {} } = options;
1805
1809
  await ensurePackages(["@eslint-react/eslint-plugin", "eslint-plugin-react-hooks"]);
1806
1810
  const [pluginReact, pluginReactHooks, pluginStylistic, parserTs] = await Promise.all([
1807
1811
  interopDefault(import("@eslint-react/eslint-plugin")),
@@ -1815,16 +1819,11 @@ async function react(options = {}) {
1815
1819
  {
1816
1820
  name: "style:react:setup",
1817
1821
  plugins: {
1818
- react: pluginReact,
1819
- "react-hooks": pluginReactHooks,
1822
+ react: plugins["@eslint-react"],
1823
+ "react-hooks": (0, import_compat2.fixupPluginRules)(pluginReactHooks),
1820
1824
  "react-hooks-extra": plugins["@eslint-react/hooks-extra"],
1821
1825
  "react-naming-convention": plugins["@eslint-react/naming-convention"],
1822
1826
  style: pluginStylistic
1823
- },
1824
- settings: {
1825
- react: {
1826
- version: "detect"
1827
- }
1828
1827
  }
1829
1828
  },
1830
1829
  {
@@ -1841,9 +1840,8 @@ async function react(options = {}) {
1841
1840
  },
1842
1841
  name: "style:react:rules",
1843
1842
  rules: {
1843
+ // recommended rules from @eslint-react
1844
1844
  "react/ensure-forward-ref-using-ref": "warn",
1845
- // recommended rules from @eslint-react/naming-convention
1846
- "react/naming-convention/use-state": "error",
1847
1845
  "react/no-access-state-in-setstate": "error",
1848
1846
  "react/no-array-index-key": "warn",
1849
1847
  "react/no-children-count": "warn",
@@ -1852,18 +1850,17 @@ async function react(options = {}) {
1852
1850
  "react/no-children-only": "warn",
1853
1851
  "react/no-children-prop": "warn",
1854
1852
  "react/no-children-to-array": "warn",
1855
- // recommended rules from @eslint-react
1856
1853
  "react/no-class-component": "error",
1857
1854
  "react/no-clone-element": "warn",
1858
1855
  "react/no-comment-textnodes": "warn",
1859
- "react/no-complicated-conditional-rendering": "warn",
1856
+ "react/no-complicated-conditional-rendering": "off",
1860
1857
  "react/no-component-will-mount": "error",
1861
1858
  "react/no-component-will-receive-props": "error",
1862
1859
  "react/no-component-will-update": "error",
1863
1860
  "react/no-create-ref": "error",
1864
1861
  "react/no-direct-mutation-state": "error",
1865
1862
  "react/no-duplicate-key": "error",
1866
- "react/no-implicit-key": "error",
1863
+ "react/no-implicit-key": "off",
1867
1864
  "react/no-leaked-conditional-rendering": "warn",
1868
1865
  "react/no-missing-key": "error",
1869
1866
  "react/no-nested-components": "warn",
@@ -1887,8 +1884,12 @@ async function react(options = {}) {
1887
1884
  "react-hooks/exhaustive-deps": "warn",
1888
1885
  "react-hooks/rules-of-hooks": "error",
1889
1886
  // recommended rules from @eslint-react/hooks-extra
1890
- "react-hooks-extra/ensure-custom-hooks-using-other-hooks": "warn",
1891
- "react-hooks-extra/ensure-use-callback-has-non-empty-deps": "warn",
1887
+ "react-hooks-extra/ensure-custom-hooks-using-other-hooks": "error",
1888
+ "react-hooks-extra/ensure-use-callback-has-non-empty-deps": "error",
1889
+ "react-hooks-extra/ensure-use-memo-has-non-empty-deps": "error",
1890
+ "react-hooks-extra/prefer-use-state-lazy-initialization": "error",
1891
+ // recommended rules from @eslint-react/naming-convention
1892
+ "react-naming-convention/use-state": "error",
1892
1893
  // "react/destructuring-assignment": [
1893
1894
  // "error",
1894
1895
  // "always",
@@ -1945,8 +1946,6 @@ async function react(options = {}) {
1945
1946
  // component: true,
1946
1947
  // },
1947
1948
  // ],
1948
- "react-hooks-extra/ensure-use-memo-has-non-empty-deps": "warn",
1949
- "react-hooks-extra/prefer-use-state-lazy-initialization": "warn",
1950
1949
  "style/jsx-curly-brace-presence": [
1951
1950
  "error",
1952
1951
  {
@@ -1971,6 +1970,10 @@ async function react(options = {}) {
1971
1970
  settings: {
1972
1971
  react: {
1973
1972
  version: "17.0"
1973
+ },
1974
+ reactOptions: {
1975
+ importSource: "@rbxts",
1976
+ jsxPragma: "React"
1974
1977
  }
1975
1978
  }
1976
1979
  },
@@ -2013,7 +2016,7 @@ async function roblox(options = {}) {
2013
2016
  },
2014
2017
  name: "style:roblox",
2015
2018
  plugins: {
2016
- roblox: import_eslint_plugin_roblox_ts.default
2019
+ roblox: import_isentinel_eslint_plugin_roblox_ts.default
2017
2020
  },
2018
2021
  rules: {
2019
2022
  "roblox/lua-truthiness": "warn",
@@ -2044,17 +2047,18 @@ async function roblox(options = {}) {
2044
2047
 
2045
2048
  // src/configs/shopify.ts
2046
2049
  init_cjs_shims();
2050
+ var import_compat3 = require("@eslint/compat");
2047
2051
  async function shopify() {
2048
2052
  return [
2049
2053
  {
2050
2054
  name: "style:shopify",
2051
2055
  plugins: {
2052
- shopify: import_eslint_plugin.default
2056
+ shopify: (0, import_compat3.fixupPluginRules)(import_eslint_plugin.default)
2053
2057
  },
2054
2058
  rules: {
2055
2059
  "shopify/prefer-class-properties": "error",
2056
2060
  "shopify/prefer-early-return": ["error", { maximumStatements: 1 }],
2057
- // "shopify/prefer-module-scope-constants": "error",
2061
+ "shopify/prefer-module-scope-constants": "error",
2058
2062
  "shopify/strict-component-boundaries": "error",
2059
2063
  "shopify/typescript/prefer-pascal-case-enums": "error",
2060
2064
  "shopify/typescript/prefer-singular-enums": "error"
@@ -2086,8 +2090,8 @@ async function sonarjs() {
2086
2090
  ],
2087
2091
  "sonar/no-duplicated-branches": "error",
2088
2092
  "sonar/no-element-overwrite": "error",
2089
- // "sonar/no-empty-collection": "error",
2090
- // "sonar/no-gratuitous-expressions": "off",
2093
+ "sonar/no-empty-collection": "error",
2094
+ "sonar/no-gratuitous-expressions": "off",
2091
2095
  "sonar/no-identical-conditions": "error",
2092
2096
  "sonar/no-identical-expressions": "error",
2093
2097
  "sonar/no-identical-functions": "error",
@@ -2095,11 +2099,11 @@ async function sonarjs() {
2095
2099
  "sonar/no-inverted-boolean-check": "error",
2096
2100
  "sonar/no-nested-switch": "error",
2097
2101
  "sonar/no-nested-template-literals": "error",
2098
- // "sonar/no-one-iteration-loop": "error",
2102
+ "sonar/no-one-iteration-loop": "error",
2099
2103
  "sonar/no-redundant-boolean": "error",
2100
- // "sonar/no-redundant-jump": "error",
2101
- // "sonar/no-unused-collection": "error",
2102
- // "sonar/no-use-of-empty-return-value": "error",
2104
+ "sonar/no-redundant-jump": "error",
2105
+ "sonar/no-unused-collection": "error",
2106
+ "sonar/no-use-of-empty-return-value": "error",
2103
2107
  "sonar/no-useless-catch": "error",
2104
2108
  "sonar/non-existent-operator": "error",
2105
2109
  "sonar/prefer-immediate-return": "error",
@@ -2481,12 +2485,10 @@ async function typescript(options = {}) {
2481
2485
  },
2482
2486
  name: "style:typescript:rules",
2483
2487
  rules: {
2484
- ...renameRules(
2485
- pluginTs.configs["eslint-recommended"].overrides?.[0].rules ?? {},
2486
- "@typescript-eslint/",
2487
- "ts/"
2488
- ),
2489
- ...renameRules(pluginTs.configs.strict.rules ?? {}, "@typescript-eslint/", "ts/"),
2488
+ ...renameRules(pluginTs.configs["eslint-recommended"].overrides?.[0].rules ?? {}, {
2489
+ "@typescript-eslint": "ts"
2490
+ }),
2491
+ ...renameRules(pluginTs.configs.strict.rules ?? {}, { "@typescript-eslint": "ts" }),
2490
2492
  "array-callback-return": [
2491
2493
  "error",
2492
2494
  {
@@ -2846,7 +2848,8 @@ function style(options = {}, ...userConfigs) {
2846
2848
  prettier({
2847
2849
  ...typeof enableTypeScript !== "boolean" ? enableTypeScript : {},
2848
2850
  componentExts: componentExtensions,
2849
- overrides: getOverrides(options, "typescript")
2851
+ overrides: getOverrides(options, "typescript"),
2852
+ prettierOptions: typeof options["formatters"] === "boolean" ? {} : options["formatters"]?.prettierOptions || {}
2850
2853
  })
2851
2854
  );
2852
2855
  const fusedConfig = flatConfigProps.reduce((accumulator, key) => {