@isentinel/eslint-config 0.4.0 → 0.5.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/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
  })
@@ -1376,7 +1378,7 @@ async function jsdoc(options = {}) {
1376
1378
  },
1377
1379
  rules: {
1378
1380
  "jsdoc/check-access": "warn",
1379
- "jsdoc/check-param-names": "warn",
1381
+ "jsdoc/check-param-names": ["warn", { checkDestructured: false }],
1380
1382
  "jsdoc/check-property-names": "warn",
1381
1383
  "jsdoc/check-types": "warn",
1382
1384
  "jsdoc/empty-tags": "warn",
@@ -1391,7 +1393,10 @@ async function jsdoc(options = {}) {
1391
1393
  "jsdoc/require-description": ["warn", { exemptedBy: ["hidden, ignore"] }],
1392
1394
  "jsdoc/require-description-complete-sentence": "warn",
1393
1395
  "jsdoc/require-hyphen-before-param-description": "warn",
1394
- "jsdoc/require-param": ["warn", { exemptedBy: ["hidden"] }],
1396
+ "jsdoc/require-param": [
1397
+ "warn",
1398
+ { checkDestructured: false, exemptedBy: ["ignore"] }
1399
+ ],
1395
1400
  "jsdoc/require-param-description": "warn",
1396
1401
  "jsdoc/require-param-name": "warn",
1397
1402
  "jsdoc/require-property": "warn",
@@ -1627,23 +1632,23 @@ async function perfectionist() {
1627
1632
 
1628
1633
  // src/configs/prettier.ts
1629
1634
  init_cjs_shims();
1630
- async function prettier(options = {}) {
1631
- const { componentExts: componentExtensions = [] } = options;
1632
- const files = options.files ?? [
1635
+ async function prettier(options) {
1636
+ const {
1637
+ componentExts: componentExtensions = [],
1638
+ files: prettierFiles,
1639
+ prettierOptions
1640
+ } = options ?? {};
1641
+ const files = prettierFiles ?? [
1633
1642
  GLOB_SRC,
1634
1643
  ...componentExtensions.map((extension) => `**/*.${extension}`)
1635
1644
  ];
1636
- const prettierOptions = {
1645
+ const defaultPrettierOptions = prettierOptions ?? {
1637
1646
  arrowParens: "avoid",
1638
- jsdocPreferCodeFences: true,
1639
- jsdocPrintWidth: 80,
1640
- plugins: ["prettier-plugin-jsdoc"],
1641
- printWidth: 100,
1647
+ printWidth: 120,
1642
1648
  semi: true,
1643
1649
  singleQuote: false,
1644
1650
  tabWidth: 4,
1645
1651
  trailingComma: "all",
1646
- tsdoc: true,
1647
1652
  useTabs: true
1648
1653
  };
1649
1654
  return [
@@ -1659,7 +1664,7 @@ async function prettier(options = {}) {
1659
1664
  "format/prettier": [
1660
1665
  "error",
1661
1666
  {
1662
- ...prettierOptions,
1667
+ ...defaultPrettierOptions,
1663
1668
  parser: "typescript"
1664
1669
  }
1665
1670
  ],
@@ -1760,12 +1765,13 @@ async function prettier(options = {}) {
1760
1765
 
1761
1766
  // src/configs/promise.ts
1762
1767
  init_cjs_shims();
1768
+ var import_compat = require("@eslint/compat");
1763
1769
  async function promise() {
1764
1770
  return [
1765
1771
  {
1766
1772
  name: "style:promise",
1767
1773
  plugins: {
1768
- promise: import_eslint_plugin_promise.default
1774
+ promise: (0, import_compat.fixupPluginRules)(import_eslint_plugin_promise.default)
1769
1775
  },
1770
1776
  rules: {
1771
1777
  "promise/always-return": [
@@ -1785,11 +1791,11 @@ async function promise() {
1785
1791
  "promise/no-callback-in-promise": "off",
1786
1792
  "promise/no-multiple-resolved": "warn",
1787
1793
  "promise/no-native": "off",
1788
- // "promise/no-nesting": "warn",
1794
+ "promise/no-nesting": "warn",
1789
1795
  "promise/no-new-statics": "off",
1790
- // "promise/no-promise-in-callback": "warn",
1796
+ "promise/no-promise-in-callback": "warn",
1791
1797
  "promise/no-return-in-finally": "warn",
1792
- // "promise/no-return-wrap": "error",
1798
+ "promise/no-return-wrap": "error",
1793
1799
  "promise/param-names": "warn",
1794
1800
  "promise/prefer-await-to-callbacks": "off",
1795
1801
  "promise/prefer-await-to-then": "off"
@@ -1800,8 +1806,9 @@ async function promise() {
1800
1806
 
1801
1807
  // src/configs/react.ts
1802
1808
  init_cjs_shims();
1809
+ var import_compat2 = require("@eslint/compat");
1803
1810
  async function react(options = {}) {
1804
- const { files = [GLOB_JSX, GLOB_TSX], overrides = {} } = options;
1811
+ const { files = [GLOB_TS, GLOB_TSX], overrides = {} } = options;
1805
1812
  await ensurePackages(["@eslint-react/eslint-plugin", "eslint-plugin-react-hooks"]);
1806
1813
  const [pluginReact, pluginReactHooks, pluginStylistic, parserTs] = await Promise.all([
1807
1814
  interopDefault(import("@eslint-react/eslint-plugin")),
@@ -1815,16 +1822,11 @@ async function react(options = {}) {
1815
1822
  {
1816
1823
  name: "style:react:setup",
1817
1824
  plugins: {
1818
- react: pluginReact,
1819
- "react-hooks": pluginReactHooks,
1825
+ react: plugins["@eslint-react"],
1826
+ "react-hooks": (0, import_compat2.fixupPluginRules)(pluginReactHooks),
1820
1827
  "react-hooks-extra": plugins["@eslint-react/hooks-extra"],
1821
1828
  "react-naming-convention": plugins["@eslint-react/naming-convention"],
1822
1829
  style: pluginStylistic
1823
- },
1824
- settings: {
1825
- react: {
1826
- version: "detect"
1827
- }
1828
1830
  }
1829
1831
  },
1830
1832
  {
@@ -1841,9 +1843,8 @@ async function react(options = {}) {
1841
1843
  },
1842
1844
  name: "style:react:rules",
1843
1845
  rules: {
1846
+ // recommended rules from @eslint-react
1844
1847
  "react/ensure-forward-ref-using-ref": "warn",
1845
- // recommended rules from @eslint-react/naming-convention
1846
- "react/naming-convention/use-state": "error",
1847
1848
  "react/no-access-state-in-setstate": "error",
1848
1849
  "react/no-array-index-key": "warn",
1849
1850
  "react/no-children-count": "warn",
@@ -1852,18 +1853,17 @@ async function react(options = {}) {
1852
1853
  "react/no-children-only": "warn",
1853
1854
  "react/no-children-prop": "warn",
1854
1855
  "react/no-children-to-array": "warn",
1855
- // recommended rules from @eslint-react
1856
1856
  "react/no-class-component": "error",
1857
1857
  "react/no-clone-element": "warn",
1858
1858
  "react/no-comment-textnodes": "warn",
1859
- "react/no-complicated-conditional-rendering": "warn",
1859
+ "react/no-complicated-conditional-rendering": "off",
1860
1860
  "react/no-component-will-mount": "error",
1861
1861
  "react/no-component-will-receive-props": "error",
1862
1862
  "react/no-component-will-update": "error",
1863
1863
  "react/no-create-ref": "error",
1864
1864
  "react/no-direct-mutation-state": "error",
1865
1865
  "react/no-duplicate-key": "error",
1866
- "react/no-implicit-key": "error",
1866
+ "react/no-implicit-key": "off",
1867
1867
  "react/no-leaked-conditional-rendering": "warn",
1868
1868
  "react/no-missing-key": "error",
1869
1869
  "react/no-nested-components": "warn",
@@ -1887,8 +1887,12 @@ async function react(options = {}) {
1887
1887
  "react-hooks/exhaustive-deps": "warn",
1888
1888
  "react-hooks/rules-of-hooks": "error",
1889
1889
  // 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",
1890
+ "react-hooks-extra/ensure-custom-hooks-using-other-hooks": "error",
1891
+ "react-hooks-extra/ensure-use-callback-has-non-empty-deps": "error",
1892
+ "react-hooks-extra/ensure-use-memo-has-non-empty-deps": "error",
1893
+ "react-hooks-extra/prefer-use-state-lazy-initialization": "error",
1894
+ // recommended rules from @eslint-react/naming-convention
1895
+ "react-naming-convention/use-state": "error",
1892
1896
  // "react/destructuring-assignment": [
1893
1897
  // "error",
1894
1898
  // "always",
@@ -1945,8 +1949,6 @@ async function react(options = {}) {
1945
1949
  // component: true,
1946
1950
  // },
1947
1951
  // ],
1948
- "react-hooks-extra/ensure-use-memo-has-non-empty-deps": "warn",
1949
- "react-hooks-extra/prefer-use-state-lazy-initialization": "warn",
1950
1952
  "style/jsx-curly-brace-presence": [
1951
1953
  "error",
1952
1954
  {
@@ -1971,6 +1973,10 @@ async function react(options = {}) {
1971
1973
  settings: {
1972
1974
  react: {
1973
1975
  version: "17.0"
1976
+ },
1977
+ reactOptions: {
1978
+ importSource: "@rbxts",
1979
+ jsxPragma: "React"
1974
1980
  }
1975
1981
  }
1976
1982
  },
@@ -2013,7 +2019,7 @@ async function roblox(options = {}) {
2013
2019
  },
2014
2020
  name: "style:roblox",
2015
2021
  plugins: {
2016
- roblox: import_eslint_plugin_roblox_ts.default
2022
+ roblox: import_isentinel_eslint_plugin_roblox_ts.default
2017
2023
  },
2018
2024
  rules: {
2019
2025
  "roblox/lua-truthiness": "warn",
@@ -2044,17 +2050,18 @@ async function roblox(options = {}) {
2044
2050
 
2045
2051
  // src/configs/shopify.ts
2046
2052
  init_cjs_shims();
2053
+ var import_compat3 = require("@eslint/compat");
2047
2054
  async function shopify() {
2048
2055
  return [
2049
2056
  {
2050
2057
  name: "style:shopify",
2051
2058
  plugins: {
2052
- shopify: import_eslint_plugin.default
2059
+ shopify: (0, import_compat3.fixupPluginRules)(import_eslint_plugin.default)
2053
2060
  },
2054
2061
  rules: {
2055
2062
  "shopify/prefer-class-properties": "error",
2056
2063
  "shopify/prefer-early-return": ["error", { maximumStatements: 1 }],
2057
- // "shopify/prefer-module-scope-constants": "error",
2064
+ "shopify/prefer-module-scope-constants": "error",
2058
2065
  "shopify/strict-component-boundaries": "error",
2059
2066
  "shopify/typescript/prefer-pascal-case-enums": "error",
2060
2067
  "shopify/typescript/prefer-singular-enums": "error"
@@ -2086,8 +2093,8 @@ async function sonarjs() {
2086
2093
  ],
2087
2094
  "sonar/no-duplicated-branches": "error",
2088
2095
  "sonar/no-element-overwrite": "error",
2089
- // "sonar/no-empty-collection": "error",
2090
- // "sonar/no-gratuitous-expressions": "off",
2096
+ "sonar/no-empty-collection": "error",
2097
+ "sonar/no-gratuitous-expressions": "off",
2091
2098
  "sonar/no-identical-conditions": "error",
2092
2099
  "sonar/no-identical-expressions": "error",
2093
2100
  "sonar/no-identical-functions": "error",
@@ -2095,11 +2102,11 @@ async function sonarjs() {
2095
2102
  "sonar/no-inverted-boolean-check": "error",
2096
2103
  "sonar/no-nested-switch": "error",
2097
2104
  "sonar/no-nested-template-literals": "error",
2098
- // "sonar/no-one-iteration-loop": "error",
2105
+ "sonar/no-one-iteration-loop": "error",
2099
2106
  "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",
2107
+ "sonar/no-redundant-jump": "error",
2108
+ "sonar/no-unused-collection": "error",
2109
+ "sonar/no-use-of-empty-return-value": "error",
2103
2110
  "sonar/no-useless-catch": "error",
2104
2111
  "sonar/non-existent-operator": "error",
2105
2112
  "sonar/prefer-immediate-return": "error",
@@ -2481,12 +2488,10 @@ async function typescript(options = {}) {
2481
2488
  },
2482
2489
  name: "style:typescript:rules",
2483
2490
  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/"),
2491
+ ...renameRules(pluginTs.configs["eslint-recommended"].overrides?.[0].rules ?? {}, {
2492
+ "@typescript-eslint": "ts"
2493
+ }),
2494
+ ...renameRules(pluginTs.configs.strict.rules ?? {}, { "@typescript-eslint": "ts" }),
2490
2495
  "array-callback-return": [
2491
2496
  "error",
2492
2497
  {
@@ -2503,6 +2508,13 @@ async function typescript(options = {}) {
2503
2508
  }
2504
2509
  ],
2505
2510
  "logical-assignment-operators": "error",
2511
+ "max-classes-per-file": "error",
2512
+ "max-depth": "error",
2513
+ "max-lines": "warn",
2514
+ "max-lines-per-function": [
2515
+ "warn",
2516
+ { max: 30, skipBlankLines: true, skipComments: true }
2517
+ ],
2506
2518
  "no-autofix/no-useless-return": "error",
2507
2519
  "no-autofix/prefer-const": [
2508
2520
  "error",
@@ -2533,6 +2545,7 @@ async function typescript(options = {}) {
2533
2545
  "no-useless-return": "off",
2534
2546
  "object-shorthand": "error",
2535
2547
  "prefer-const": "off",
2548
+ "prefer-destructuring": "off",
2536
2549
  "ts/adjacent-overload-signatures": "error",
2537
2550
  "ts/array-type": [
2538
2551
  "error",
@@ -2659,7 +2672,7 @@ async function unicorn() {
2659
2672
  "unicorn/no-unreadable-array-destructuring": "error",
2660
2673
  "unicorn/no-unused-properties": "error",
2661
2674
  "unicorn/no-useless-promise-resolve-reject": "error",
2662
- "unicorn/no-useless-spread": "error",
2675
+ "unicorn/no-useless-spread": "off",
2663
2676
  "unicorn/no-useless-undefined": ["error", { checkArguments: false }],
2664
2677
  "unicorn/number-literal-case": "error",
2665
2678
  "unicorn/prefer-default-parameters": "error",
@@ -2846,7 +2859,8 @@ function style(options = {}, ...userConfigs) {
2846
2859
  prettier({
2847
2860
  ...typeof enableTypeScript !== "boolean" ? enableTypeScript : {},
2848
2861
  componentExts: componentExtensions,
2849
- overrides: getOverrides(options, "typescript")
2862
+ overrides: getOverrides(options, "typescript"),
2863
+ prettierOptions: typeof options["formatters"] === "boolean" ? {} : options["formatters"]?.prettierOptions || {}
2850
2864
  })
2851
2865
  );
2852
2866
  const fusedConfig = flatConfigProps.reduce((accumulator, key) => {