@isentinel/eslint-config 0.6.0-beta.2 → 0.6.0-beta.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/README.md CHANGED
@@ -10,7 +10,19 @@ template](https://github.com/christopher-buss/roblox-ts-project-template)
10
10
  repository. This includes all necessarily files and configurations to get you up
11
11
  and running.
12
12
 
13
- ### Install
13
+ ## Usage
14
+
15
+ ### Starter Wizard
16
+
17
+ We provided a CLI tool to help you set up your project, or migrate from the legacy config to the new flat config with one command.
18
+
19
+ ```bash
20
+ npx @isentinel/eslint-config@latest
21
+ ```
22
+
23
+ ### Manual Install
24
+
25
+ If you prefer to set up manually:
14
26
 
15
27
  ```bash
16
28
  pnpm i -D eslint @isentinel/eslint-config
package/dist/index.cjs CHANGED
@@ -34,9 +34,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
34
34
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
35
 
36
36
  // node_modules/.pnpm/tsup@8.1.0_postcss@8.4.38_typescript@5.4.5/node_modules/tsup/assets/cjs_shims.js
37
+ var getImportMetaUrl, importMetaUrl;
37
38
  var init_cjs_shims = __esm({
38
39
  "node_modules/.pnpm/tsup@8.1.0_postcss@8.4.38_typescript@5.4.5/node_modules/tsup/assets/cjs_shims.js"() {
39
40
  "use strict";
41
+ getImportMetaUrl = () => typeof document === "undefined" ? new URL("file:" + __filename).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
42
+ importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
40
43
  }
41
44
  });
42
45
 
@@ -890,71 +893,6 @@ init_cjs_shims();
890
893
  init_cjs_shims();
891
894
  var import_compat = require("@eslint/compat");
892
895
 
893
- // src/plugins.ts
894
- init_cjs_shims();
895
- var import_eslint_plugin = __toESM(require("@cspell/eslint-plugin"), 1);
896
- var import_eslint_plugin_comment_length = __toESM(require("@isentinel/eslint-plugin-comment-length"), 1);
897
- var import_eslint_plugin2 = __toESM(require("@shopify/eslint-plugin"), 1);
898
- var import_eslint_config_prettier = __toESM(require("eslint-config-prettier"), 1);
899
- var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
900
- var import_eslint_plugin_arrow_return_style = __toESM(require("eslint-plugin-arrow-return-style"), 1);
901
- var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
902
- var import_eslint_plugin_format = __toESM(require("eslint-plugin-format"), 1);
903
- var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
904
- var import_eslint_plugin_no_autofix = __toESM(require("eslint-plugin-no-autofix"), 1);
905
- var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
906
- var import_eslint_plugin_promise = __toESM(require("eslint-plugin-promise"), 1);
907
- var import_eslint_plugin_simple_import_sort = __toESM(require_eslint_plugin_simple_import_sort(), 1);
908
- var pluginSonar = __toESM(require("eslint-plugin-sonarjs"), 1);
909
- var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
910
- var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
911
- var import_isentinel_eslint_plugin_roblox_ts = __toESM(require("isentinel-eslint-plugin-roblox-ts"), 1);
912
-
913
- // src/configs/comments.ts
914
- async function comments() {
915
- return [
916
- {
917
- name: "style:eslint-comments",
918
- plugins: {
919
- "comment-length": (0, import_compat.fixupPluginRules)(import_eslint_plugin_comment_length.default),
920
- "eslint-comments": import_eslint_plugin_eslint_comments.default
921
- },
922
- rules: {
923
- "comment-length/limit-multi-line-comments": [
924
- "warn",
925
- {
926
- ignoreUrls: true,
927
- maxLength: 80
928
- }
929
- ],
930
- "comment-length/limit-single-line-comments": [
931
- "warn",
932
- {
933
- ignoreUrls: true,
934
- maxLength: 80
935
- }
936
- ],
937
- "eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
938
- "eslint-comments/no-aggregating-enable": "error",
939
- "eslint-comments/no-duplicate-disable": "error",
940
- "eslint-comments/no-unlimited-disable": "error",
941
- "eslint-comments/no-unused-enable": "error",
942
- "eslint-comments/require-description": [
943
- "error",
944
- {
945
- ignore: ["eslint-enable"]
946
- }
947
- ],
948
- "no-inline-comments": "error",
949
- "style/multiline-comment-style": ["error", "separate-lines"]
950
- }
951
- }
952
- ];
953
- }
954
-
955
- // src/configs/formatters.ts
956
- init_cjs_shims();
957
-
958
896
  // src/globs.ts
959
897
  init_cjs_shims();
960
898
  var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
@@ -1008,6 +946,67 @@ var GLOB_EXCLUDE = [
1008
946
  "**/roblox.yml"
1009
947
  ];
1010
948
 
949
+ // src/plugins.ts
950
+ init_cjs_shims();
951
+ var import_eslint_plugin = __toESM(require("@cspell/eslint-plugin"), 1);
952
+ var import_eslint_plugin_comment_length = __toESM(require("@isentinel/eslint-plugin-comment-length"), 1);
953
+ var import_eslint_plugin2 = __toESM(require("@shopify/eslint-plugin"), 1);
954
+ var import_eslint_config_prettier = __toESM(require("eslint-config-prettier"), 1);
955
+ var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
956
+ var import_eslint_plugin_arrow_return_style = __toESM(require("eslint-plugin-arrow-return-style"), 1);
957
+ var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
958
+ var import_eslint_plugin_format = __toESM(require("eslint-plugin-format"), 1);
959
+ var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
960
+ var import_eslint_plugin_no_autofix = __toESM(require("eslint-plugin-no-autofix"), 1);
961
+ var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
962
+ var import_eslint_plugin_promise = __toESM(require("eslint-plugin-promise"), 1);
963
+ var import_eslint_plugin_simple_import_sort = __toESM(require_eslint_plugin_simple_import_sort(), 1);
964
+ var pluginSonar = __toESM(require("eslint-plugin-sonarjs"), 1);
965
+ var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
966
+ var import_isentinel_eslint_plugin_roblox_ts = __toESM(require("isentinel-eslint-plugin-roblox-ts"), 1);
967
+
968
+ // src/configs/comments.ts
969
+ async function comments() {
970
+ return [
971
+ {
972
+ name: "style:eslint-comments",
973
+ plugins: {
974
+ "comment-length": (0, import_compat.fixupPluginRules)(import_eslint_plugin_comment_length.default),
975
+ "eslint-comments": import_eslint_plugin_eslint_comments.default
976
+ },
977
+ rules: {
978
+ // We cover these with prettier
979
+ "comment-length/limit-multi-line-comments": "off",
980
+ "comment-length/limit-single-line-comments": "off",
981
+ "eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
982
+ "eslint-comments/no-aggregating-enable": "error",
983
+ "eslint-comments/no-duplicate-disable": "error",
984
+ "eslint-comments/no-unlimited-disable": "error",
985
+ "eslint-comments/no-unused-enable": "error",
986
+ "eslint-comments/require-description": [
987
+ "error",
988
+ {
989
+ ignore: ["eslint-enable"]
990
+ }
991
+ ],
992
+ "no-inline-comments": "error",
993
+ "style/multiline-comment-style": ["error", "separate-lines"]
994
+ }
995
+ },
996
+ {
997
+ files: [GLOB_YAML],
998
+ rules: {
999
+ // TODO: Seems to be a false positive
1000
+ "comment-length/limit-multi-line-comments": "off",
1001
+ "no-inline-comments": "off"
1002
+ }
1003
+ }
1004
+ ];
1005
+ }
1006
+
1007
+ // src/configs/formatters.ts
1008
+ init_cjs_shims();
1009
+
1011
1010
  // src/configs/stylistic.ts
1012
1011
  init_cjs_shims();
1013
1012
 
@@ -1183,13 +1182,12 @@ async function stylistic(options = {}) {
1183
1182
 
1184
1183
  // src/configs/formatters.ts
1185
1184
  async function formatters(options = {}, stylistic2 = {}, markdownEnabled = true) {
1186
- if (options === true) {
1185
+ if (options === void 0 || options === true) {
1187
1186
  options = {
1188
1187
  css: true,
1189
1188
  graphql: true,
1190
1189
  html: true,
1191
- markdown: true,
1192
- toml: true
1190
+ markdown: true
1193
1191
  };
1194
1192
  }
1195
1193
  const { indent, quotes, semi } = {
@@ -1292,24 +1290,6 @@ async function formatters(options = {}, stylistic2 = {}, markdownEnabled = true)
1292
1290
  }
1293
1291
  });
1294
1292
  }
1295
- if (options.toml) {
1296
- configs.push({
1297
- files: ["**/*.toml"],
1298
- languageOptions: {
1299
- parser: import_eslint_plugin_format.default.parserPlain
1300
- },
1301
- name: "style:formatter:toml",
1302
- rules: {
1303
- "format/dprint": [
1304
- "error",
1305
- {
1306
- ...dprintOptions,
1307
- language: "toml"
1308
- }
1309
- ]
1310
- }
1311
- });
1312
- }
1313
1293
  if (options.markdown) {
1314
1294
  const formatter = options.markdown === true ? "prettier" : options.markdown;
1315
1295
  configs.push({
@@ -1440,7 +1420,10 @@ async function jsdoc(options = {}) {
1440
1420
  "jsdoc/no-multi-asterisks": "warn",
1441
1421
  "jsdoc/no-types": "warn",
1442
1422
  "jsdoc/require-asterisk-prefix": "warn",
1443
- "jsdoc/require-description": ["warn", { exemptedBy: ["hidden, ignore"] }],
1423
+ "jsdoc/require-description": [
1424
+ "warn",
1425
+ { exemptedBy: ["hidden, ignore", "inheritdoc", "client", "server"] }
1426
+ ],
1444
1427
  "jsdoc/require-description-complete-sentence": "warn",
1445
1428
  "jsdoc/require-hyphen-before-param-description": "warn",
1446
1429
  "jsdoc/require-param": [
@@ -1658,14 +1641,19 @@ async function prettier(options) {
1658
1641
  GLOB_SRC,
1659
1642
  ...componentExtensions.map((extension) => `**/*.${extension}`)
1660
1643
  ];
1661
- const defaultPrettierOptions = prettierOptions ?? {
1644
+ const defaultPrettierOptions = {
1662
1645
  arrowParens: "avoid",
1663
- printWidth: 120,
1646
+ jsdocPreferCodeFences: true,
1647
+ jsdocPrintWidth: 80,
1648
+ plugins: ["prettier-plugin-jsdoc"],
1649
+ printWidth: 100,
1664
1650
  semi: true,
1665
1651
  singleQuote: false,
1666
1652
  tabWidth: 4,
1667
1653
  trailingComma: "all",
1668
- useTabs: true
1654
+ tsdoc: true,
1655
+ useTabs: true,
1656
+ ...prettierOptions
1669
1657
  };
1670
1658
  return [
1671
1659
  {
@@ -2314,12 +2302,21 @@ function sortTsconfig() {
2314
2302
 
2315
2303
  // src/configs/spelling.ts
2316
2304
  init_cjs_shims();
2305
+ var import_node_module = require("module");
2306
+ var import_node_url = require("url");
2307
+ var require2 = (0, import_node_module.createRequire)(importMetaUrl);
2317
2308
  async function spelling(options = {}) {
2318
- const { componentExts: componentExtensions = [] } = options;
2309
+ const { componentExts: componentExtensions = [], language = "en-US" } = options;
2319
2310
  const files = options.files ?? [
2320
2311
  GLOB_SRC,
2321
2312
  ...componentExtensions.map((extension) => `**/*.${extension}`)
2322
2313
  ];
2314
+ const robloxDictionary = require2.resolve("@isentinel/dict-roblox");
2315
+ const urlRobloxDictionary = (0, import_node_url.pathToFileURL)(robloxDictionary);
2316
+ const urlRoblox = new URL("dict/roblox.txt", urlRobloxDictionary);
2317
+ const rbxtsDictionary = require2.resolve("@isentinel/dict-rbxts");
2318
+ const urlRbxtsDictionary = (0, import_node_url.pathToFileURL)(rbxtsDictionary);
2319
+ const urlRbxts = new URL("dict/rbxts.txt", urlRbxtsDictionary);
2323
2320
  return [
2324
2321
  {
2325
2322
  files,
@@ -2334,8 +2331,18 @@ async function spelling(options = {}) {
2334
2331
  autoFix: false,
2335
2332
  checkComments: true,
2336
2333
  cspell: {
2337
- import: ["@isentinel/dict-roblox"],
2338
- language: "en-US",
2334
+ dictionaries: ["roblox", "rbxts"],
2335
+ dictionaryDefinitions: [
2336
+ {
2337
+ name: "roblox",
2338
+ path: urlRoblox.href
2339
+ },
2340
+ {
2341
+ name: "rbxts",
2342
+ path: urlRbxts.href
2343
+ }
2344
+ ],
2345
+ language,
2339
2346
  words: ["isentinel"]
2340
2347
  },
2341
2348
  generateSuggestions: true,
@@ -2554,6 +2561,14 @@ async function typescript(options = {}) {
2554
2561
  "no-return-assign": ["error", "always"],
2555
2562
  "no-shadow": "off",
2556
2563
  "no-unneeded-ternary": "error",
2564
+ "no-unused-expressions": [
2565
+ "error",
2566
+ {
2567
+ allowShortCircuit: true,
2568
+ allowTaggedTemplates: true,
2569
+ allowTernary: true
2570
+ }
2571
+ ],
2557
2572
  "no-unused-private-class-members": "error",
2558
2573
  "no-use-before-define": "off",
2559
2574
  "no-useless-constructor": "off",
@@ -2895,7 +2910,7 @@ function style(options = {}, ...userConfigs) {
2895
2910
  if (enableSpellCheck ?? true) {
2896
2911
  configs.push(
2897
2912
  spelling({
2898
- ...resolveSubOptions(options, "typescript"),
2913
+ ...resolveSubOptions(options, "spellCheck"),
2899
2914
  componentExts: componentExtensions
2900
2915
  })
2901
2916
  );