@isentinel/eslint-config 5.0.0-beta.1 → 5.0.0-beta.2
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 +2 -2
- package/dist/index.d.mts +8 -45
- package/dist/index.mjs +125 -208
- package/package.json +2 -4
package/README.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -46,14 +46,12 @@ interface FlatGitignoreOptions {
|
|
|
46
46
|
cwd?: string;
|
|
47
47
|
}
|
|
48
48
|
//#endregion
|
|
49
|
-
//#region src/configs/
|
|
50
|
-
|
|
51
|
-
declare function prettier(options?: OptionsComponentExtensions & OptionsFiles & OptionsOverrides & OptionsTypeScriptParserOptions & {
|
|
49
|
+
//#region src/configs/oxfmt.d.ts
|
|
50
|
+
declare function oxfmt(options?: OptionsComponentExtensions & OptionsFiles & OptionsOverrides & {
|
|
52
51
|
formatters?: OptionsFormatters | true;
|
|
53
|
-
|
|
52
|
+
oxfmtConfigOptions?: FormatOptions;
|
|
53
|
+
oxfmtOptions?: FormatOptions;
|
|
54
54
|
prettierOptions?: Options;
|
|
55
|
-
stylistic?: StylisticConfig;
|
|
56
|
-
tsFormatter?: FormatterEngine;
|
|
57
55
|
}): Promise<Array<TypedFlatConfigItem>>;
|
|
58
56
|
//#endregion
|
|
59
57
|
//#region src/typegen.d.ts
|
|
@@ -833,10 +831,6 @@ interface RuleOptions {
|
|
|
833
831
|
* Use stylua to format lua files
|
|
834
832
|
*/
|
|
835
833
|
'format-lua/stylua'?: Linter.RuleEntry<FormatLuaStylua>;
|
|
836
|
-
/**
|
|
837
|
-
* @see https://github.com/prettier/eslint-plugin-prettier#options
|
|
838
|
-
*/
|
|
839
|
-
'format/prettier'?: Linter.RuleEntry<FormatPrettier>;
|
|
840
834
|
/**
|
|
841
835
|
* Require or disallow spacing between function identifiers and their invocations
|
|
842
836
|
* @see https://eslint.org/docs/latest/rules/func-call-spacing
|
|
@@ -9731,16 +9725,6 @@ type FormatLuaStylua = [] | [{
|
|
|
9731
9725
|
[k: string]: unknown | undefined;
|
|
9732
9726
|
};
|
|
9733
9727
|
[k: string]: unknown | undefined;
|
|
9734
|
-
}]; // ----- format/prettier -----
|
|
9735
|
-
type FormatPrettier = [] | [{
|
|
9736
|
-
[k: string]: unknown | undefined;
|
|
9737
|
-
}] | [{
|
|
9738
|
-
[k: string]: unknown | undefined;
|
|
9739
|
-
}, {
|
|
9740
|
-
usePrettierrc?: boolean;
|
|
9741
|
-
fileInfoOptions?: {
|
|
9742
|
-
[k: string]: unknown | undefined;
|
|
9743
|
-
};
|
|
9744
9728
|
}]; // ----- func-call-spacing -----
|
|
9745
9729
|
type FuncCallSpacing = ([] | ["never"] | [] | ["always"] | ["always", {
|
|
9746
9730
|
allowNewlines?: boolean;
|
|
@@ -17590,7 +17574,7 @@ type Yoda = [] | [("always" | "never")] | [("always" | "never"), {
|
|
|
17590
17574
|
exceptRange?: boolean;
|
|
17591
17575
|
onlyEquality?: boolean;
|
|
17592
17576
|
}]; // Names of all the configs
|
|
17593
|
-
type ConfigNames = 'isentinel/cease-nonsense' | 'isentinel/eslint/comments' | 'isentinel/eslint/comments/src' | 'isentinel/eslint-plugin/setup' | 'isentinel/eslint-plugin/rules' | 'isentinel/flawless/setup' | 'isentinel/flawless/ts/rules-type-aware' | 'isentinel/flawless/tsx/rules-type-aware' | 'isentinel/gitignore' | 'isentinel/ignores' | 'isentinel/imports/rules' | 'isentinel/imports/game' | 'isentinel/javascript/setup' | 'isentinel/javascript/rules' | 'isentinel/jsdoc/setup' | 'isentinel/jsdoc' | 'isentinel/jsonc/setup' | 'isentinel/jsonc/rules' | 'isentinel/markdown/setup' | 'isentinel/markdown/processor' | 'isentinel/markdown/parser' | 'isentinel/markdown/disables' | 'isentinel/node/rules' | 'isentinel/oxfmt/setup' | 'isentinel/oxfmt/javascript' | 'isentinel/oxfmt/typescript' | 'isentinel/
|
|
17577
|
+
type ConfigNames = 'isentinel/cease-nonsense' | 'isentinel/eslint/comments' | 'isentinel/eslint/comments/src' | 'isentinel/eslint-plugin/setup' | 'isentinel/eslint-plugin/rules' | 'isentinel/flawless/setup' | 'isentinel/flawless/ts/rules-type-aware' | 'isentinel/flawless/tsx/rules-type-aware' | 'isentinel/gitignore' | 'isentinel/ignores' | 'isentinel/imports/rules' | 'isentinel/imports/game' | 'isentinel/javascript/setup' | 'isentinel/javascript/rules' | 'isentinel/jsdoc/setup' | 'isentinel/jsdoc' | 'isentinel/jsonc/setup' | 'isentinel/jsonc/rules' | 'isentinel/markdown/setup' | 'isentinel/markdown/processor' | 'isentinel/markdown/parser' | 'isentinel/markdown/disables' | 'isentinel/node/rules' | 'isentinel/oxfmt/setup' | 'isentinel/oxfmt/javascript' | 'isentinel/oxfmt/typescript' | 'isentinel/oxfmt/css' | 'isentinel/oxfmt/scss' | 'isentinel/oxfmt/less' | 'isentinel/oxfmt/html' | 'isentinel/oxfmt/markdown' | 'isentinel/oxfmt/graphql' | 'isentinel/oxfmt/json' | 'isentinel/oxfmt/yaml' | 'isentinel/package-json/setup' | 'isentinel/package-json' | 'isentinel/perfectionist/setup' | 'isentinel/perfectionist' | 'isentinel/perfectionist/jsx' | 'isentinel/pnpm/setup' | 'isentinel/pnpm/package-json' | 'isentinel/pnpm/pnpm-workspace-yaml' | 'isentinel/promise' | 'isentinel/react/setup' | 'isentinel/react/setup/naming' | 'isentinel/react/rules' | 'isentinel/react/type-aware-rules' | 'isentinel/roblox/setup' | 'isentinel/roblox/parser' | 'isentinel/roblox/type-aware-parser' | 'isentinel/roblox' | 'isentinel/roblox/rules-type-aware' | 'isentinel/roblox/format-lua/setup' | 'isentinel/roblox/format-lua' | 'isentinel/sonarjs' | 'isentinel/spelling/setup' | 'isentinel/spelling' | 'isentinel/stylistic/setup' | 'isentinel/stylistic' | 'isentinel/stylistic/ts' | 'isentinel/stylistic/js' | 'isentinel/stylistic/markdown-code' | 'isentinel/test/jest/setup' | 'isentinel/test/jest/rules' | 'isentinel/test/vitest/setup' | 'isentinel/test/vitest/rules' | 'isentinel/toml/setup' | 'isentinel/toml/rules' | 'isentinel/typescript/setup' | 'isentinel/typescript/parser' | 'isentinel/typescript/type-aware-parser' | 'isentinel/typescript/rules' | 'isentinel/typescript/rules-type-aware' | 'isentinel/typescript/erasable-syntax-only' | 'isentinel/unicorn' | 'isentinel/unicorn/root' | 'isentinel/yaml/setup' | 'isentinel/yaml/rules';
|
|
17594
17578
|
//#endregion
|
|
17595
17579
|
//#region src/utils.d.ts
|
|
17596
17580
|
type ExtractRuleOptions<T> = T extends Linter.RuleEntry<infer U> ? U : never;
|
|
@@ -17652,7 +17636,6 @@ interface OptionsFilesTypeAware extends OptionsFiles {
|
|
|
17652
17636
|
*/
|
|
17653
17637
|
ignoresTypeAware?: Array<string>;
|
|
17654
17638
|
}
|
|
17655
|
-
type FormatterEngine = "oxfmt" | "prettier";
|
|
17656
17639
|
interface OptionsFormatters {
|
|
17657
17640
|
/**
|
|
17658
17641
|
* Enable formatting support for CSS, Less, Sass, and SCSS.
|
|
@@ -17672,12 +17655,6 @@ interface OptionsFormatters {
|
|
|
17672
17655
|
* @default true
|
|
17673
17656
|
*/
|
|
17674
17657
|
html?: boolean;
|
|
17675
|
-
/**
|
|
17676
|
-
* Formatter engine for JavaScript files.
|
|
17677
|
-
*
|
|
17678
|
-
* @default "oxfmt"
|
|
17679
|
-
*/
|
|
17680
|
-
javascript?: FormatterEngine;
|
|
17681
17658
|
/**
|
|
17682
17659
|
* Enable formatting support for JSON(C|5).
|
|
17683
17660
|
*
|
|
@@ -17704,15 +17681,10 @@ interface OptionsFormatters {
|
|
|
17704
17681
|
/**
|
|
17705
17682
|
* Custom options for Prettier.
|
|
17706
17683
|
*
|
|
17707
|
-
*
|
|
17684
|
+
* Used for arrow-return-style-x and as a migration source for oxfmt
|
|
17685
|
+
* options.
|
|
17708
17686
|
*/
|
|
17709
17687
|
prettierOptions?: PrettierOptions;
|
|
17710
|
-
/**
|
|
17711
|
-
* Formatter engine for TypeScript files.
|
|
17712
|
-
*
|
|
17713
|
-
* @default "oxfmt"
|
|
17714
|
-
*/
|
|
17715
|
-
typescript?: FormatterEngine;
|
|
17716
17688
|
/**
|
|
17717
17689
|
* Enable formatting support for YAML.
|
|
17718
17690
|
*
|
|
@@ -18130,15 +18102,6 @@ declare function markdown(options?: OptionsComponentExtensions & OptionsFiles &
|
|
|
18130
18102
|
//#region src/configs/node.d.ts
|
|
18131
18103
|
declare function node(): Promise<Array<TypedFlatConfigItem>>;
|
|
18132
18104
|
//#endregion
|
|
18133
|
-
//#region src/configs/oxfmt.d.ts
|
|
18134
|
-
declare function oxfmt(options?: OptionsComponentExtensions & OptionsFiles & OptionsOverrides & {
|
|
18135
|
-
jsFormatter?: FormatterEngine;
|
|
18136
|
-
oxfmtConfigOptions?: FormatOptions;
|
|
18137
|
-
oxfmtOptions?: FormatOptions;
|
|
18138
|
-
prettierOptions?: PrettierOptions;
|
|
18139
|
-
tsFormatter?: FormatterEngine;
|
|
18140
|
-
}): Promise<Array<TypedFlatConfigItem>>;
|
|
18141
|
-
//#endregion
|
|
18142
18105
|
//#region src/configs/package-json.d.ts
|
|
18143
18106
|
declare function packageJson(options?: OptionsHasRoblox & OptionsProjectType & OptionsStylistic): Promise<Array<TypedFlatConfigItem>>;
|
|
18144
18107
|
//#endregion
|
|
@@ -18282,4 +18245,4 @@ declare const GLOB_BUILD_TOOLS: Array<string>;
|
|
|
18282
18245
|
declare const GLOB_ALL_SRC: string[];
|
|
18283
18246
|
declare const GLOB_EXCLUDE: string[];
|
|
18284
18247
|
//#endregion
|
|
18285
|
-
export { Awaitable, type ConfigNames, type FlatConfigComposer,
|
|
18248
|
+
export { Awaitable, type ConfigNames, type FlatConfigComposer, GLOB_ALL_JSON, GLOB_ALL_SRC, GLOB_BUILD_TOOLS, GLOB_CSS, GLOB_DTS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LUA, GLOB_MARKDOWN, GLOB_MARKDOWN_BLOCKS, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_ROOT, GLOB_ROOT_SRC, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_XML, GLOB_YAML, GitignoreOptions, JsdocOptions, NamedFlatConfigItem, NamedOptionsConfig, OptionsComponentExtensions, OptionsConfig, OptionsFiles, OptionsFilesTypeAware, OptionsFormatters, OptionsHasRoblox, OptionsHasTypeScript, OptionsIsInEditor, OptionsJest, OptionsOverrides, OptionsOverridesTypeAware, OptionsPnpm, OptionsProjectType, OptionsStylistic, OptionsTestFramework, OptionsTypeScriptErasableOnly, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsVitest, type OxfmtOptions, PerfectionistConfig, type PrettierOptions, ReactConfig, Rules, SpellCheckConfig, StylisticConfig, StylisticConfigDefaults, TypedFlatConfigItem, ceaseNonsense, comments, isentinel as default, isentinel, defaultPluginRenaming, disables, eslintPlugin, flawless, gitignore, ignores, imports, javascript, jsdoc, jsonc, markdown, node, oxfmt, packageJson, perfectionist, pnpm, promise, react, roblox, sonarjs, sortGithubAction, sortPnpmWorkspace, sortRojoProject, sortTsconfig, spelling, stylistic, test, toml, typescript, unicorn, yaml };
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { isPackageExists } from "local-pkg";
|
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import path, { dirname, join, relative, resolve } from "node:path";
|
|
5
5
|
import process from "node:process";
|
|
6
|
-
import prettier
|
|
6
|
+
import prettier from "prettier";
|
|
7
7
|
import { findUp, findUpSync } from "find-up-simple";
|
|
8
8
|
import { convertIgnorePatternToMinimatch } from "@eslint/compat";
|
|
9
9
|
import fs$1 from "node:fs/promises";
|
|
@@ -187,13 +187,6 @@ function mergeGlobs(globs, additionalPatterns) {
|
|
|
187
187
|
} else result.push(pattern);
|
|
188
188
|
return result;
|
|
189
189
|
}
|
|
190
|
-
function mergePrettierOptions(options, overrides = {}) {
|
|
191
|
-
return {
|
|
192
|
-
...options,
|
|
193
|
-
...overrides,
|
|
194
|
-
plugins: [...overrides.plugins ?? [], ...options.plugins ?? []]
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
190
|
/**
|
|
198
191
|
* Rename plugin prefixes in a rule object. Accepts a map of prefixes to rename.
|
|
199
192
|
*
|
|
@@ -232,7 +225,7 @@ function renameRules(rules, map) {
|
|
|
232
225
|
*/
|
|
233
226
|
async function resolvePrettierConfigOptions() {
|
|
234
227
|
try {
|
|
235
|
-
return await prettier
|
|
228
|
+
return await prettier.resolveConfig("package.json", { editorconfig: true }) ?? {};
|
|
236
229
|
} catch {
|
|
237
230
|
return {};
|
|
238
231
|
}
|
|
@@ -247,7 +240,7 @@ async function resolveOxfmtConfigOptions() {
|
|
|
247
240
|
for (const filename of OXFMT_CONFIG_FILES) {
|
|
248
241
|
const configPath = path.resolve(process.cwd(), filename);
|
|
249
242
|
try {
|
|
250
|
-
const content = fs.
|
|
243
|
+
const content = await fs.promises.readFile(configPath, "utf-8");
|
|
251
244
|
return JSON.parse(content);
|
|
252
245
|
} catch {
|
|
253
246
|
continue;
|
|
@@ -256,17 +249,6 @@ async function resolveOxfmtConfigOptions() {
|
|
|
256
249
|
return {};
|
|
257
250
|
}
|
|
258
251
|
/**
|
|
259
|
-
* Check if a feature should be enabled based on options. Handles the pattern
|
|
260
|
-
* where features can be disabled globally or individually.
|
|
261
|
-
*
|
|
262
|
-
* @template T - The type of the options object.
|
|
263
|
-
* @template K - The key type within the options object.
|
|
264
|
-
* @param options - The options object (true | false | undefined | object).
|
|
265
|
-
* @param key - The key to check within the options object.
|
|
266
|
-
* @param defaultValue - Default value when key is not specified.
|
|
267
|
-
* @returns Whether the feature should be enabled.
|
|
268
|
-
*/
|
|
269
|
-
/**
|
|
270
252
|
* Override the severity of all rules in a rules object, preserving rule
|
|
271
253
|
* options. Rules set to `"off"` are not affected.
|
|
272
254
|
*
|
|
@@ -398,7 +380,7 @@ const GLOB_EXCLUDE = [
|
|
|
398
380
|
"**/.cache",
|
|
399
381
|
"**/.changeset",
|
|
400
382
|
"**/.agents",
|
|
401
|
-
"**/.claude",
|
|
383
|
+
"**/.claude/**/*",
|
|
402
384
|
"**/.gemini",
|
|
403
385
|
"**/.kilocode",
|
|
404
386
|
"**/.opencode",
|
|
@@ -462,8 +444,8 @@ async function comments(options = {}) {
|
|
|
462
444
|
name: "isentinel/eslint/comments/src",
|
|
463
445
|
files: [GLOB_SRC],
|
|
464
446
|
rules: { "comment-length/limit-single-line-comments": ["error", {
|
|
465
|
-
maxLength: Number(prettierOptions["jsdocPrintWidth"]) + 2,
|
|
466
|
-
tabSize: prettierOptions.tabWidth
|
|
447
|
+
maxLength: (Number(prettierOptions["jsdocPrintWidth"]) || 80) + 2,
|
|
448
|
+
tabSize: prettierOptions.tabWidth ?? 4
|
|
467
449
|
}] }
|
|
468
450
|
}] : []];
|
|
469
451
|
}
|
|
@@ -531,6 +513,7 @@ async function disables(options) {
|
|
|
531
513
|
"max-lines-per-function": "off",
|
|
532
514
|
"no-empty-function": "off",
|
|
533
515
|
"no-unused-expressions": "off",
|
|
516
|
+
"sonar/no-duplicate-string": "off",
|
|
534
517
|
"ts/explicit-function-return-type": "off",
|
|
535
518
|
"ts/no-empty-function": "off",
|
|
536
519
|
"ts/no-non-null-assertion": "off",
|
|
@@ -1726,7 +1709,7 @@ const defaultPluginRenaming = {
|
|
|
1726
1709
|
"yml": "yaml"
|
|
1727
1710
|
};
|
|
1728
1711
|
async function isentinel(options, ...userConfigs) {
|
|
1729
|
-
const { autoRenamePlugins = true, componentExts: componentExtensions = [], eslintPlugin: enableEslintPlugin = false, formatters, gitignore: enableGitignore = true, jsdoc: enableJsdoc = true, jsx: enableJsx = true, pnpm: enableCatalogs = findUpSync("pnpm-workspace.yaml") !== void 0, react: enableReact = false, root: customRootGlobs, spellCheck: enableSpellCheck
|
|
1712
|
+
const { autoRenamePlugins = true, componentExts: componentExtensions = [], eslintPlugin: enableEslintPlugin = false, formatters, gitignore: enableGitignore = true, jsdoc: enableJsdoc = true, jsx: enableJsx = true, pnpm: enableCatalogs = findUpSync("pnpm-workspace.yaml") !== void 0, react: enableReact = false, root: customRootGlobs, spellCheck: enableSpellCheck } = options;
|
|
1730
1713
|
const rootGlobs = mergeGlobs(GLOB_ROOT, customRootGlobs);
|
|
1731
1714
|
const enableRoblox = options.roblox !== false;
|
|
1732
1715
|
let { defaultSeverity, isInEditor } = options;
|
|
@@ -1747,24 +1730,17 @@ async function isentinel(options, ...userConfigs) {
|
|
|
1747
1730
|
})();
|
|
1748
1731
|
if (stylisticOptions !== false && !("jsx" in stylisticOptions)) stylisticOptions.jsx = enableJsx;
|
|
1749
1732
|
const formatterOptions = typeof options.formatters === "object" ? options.formatters : {};
|
|
1750
|
-
const jsFormatter = formatterOptions.javascript ?? "oxfmt";
|
|
1751
|
-
const tsFormatter = formatterOptions.typescript ?? "oxfmt";
|
|
1752
|
-
const useOxfmt = options.formatters !== false && (jsFormatter === "oxfmt" || tsFormatter === "oxfmt");
|
|
1753
1733
|
const prettierOptions = formatterOptions.prettierOptions ?? {};
|
|
1754
1734
|
const editorConfigOptions = await resolvePrettierConfigOptions();
|
|
1755
|
-
const oxfmtConfigOptions =
|
|
1735
|
+
const oxfmtConfigOptions = options.formatters !== false ? await resolveOxfmtConfigOptions() : {};
|
|
1756
1736
|
const prettierSettings = Object.assign({
|
|
1757
1737
|
arrowParens: "always",
|
|
1758
|
-
jsdocPreferCodeFences: true,
|
|
1759
|
-
jsdocPrintWidth: 80,
|
|
1760
|
-
plugins: [require$1.resolve("prettier-plugin-jsdoc")],
|
|
1761
1738
|
printWidth: 100,
|
|
1762
1739
|
quoteProps: "consistent",
|
|
1763
1740
|
semi: true,
|
|
1764
1741
|
singleQuote: false,
|
|
1765
1742
|
tabWidth: 4,
|
|
1766
1743
|
trailingComma: "all",
|
|
1767
|
-
tsdoc: true,
|
|
1768
1744
|
useTabs: true
|
|
1769
1745
|
}, editorConfigOptions, prettierOptions);
|
|
1770
1746
|
const configs = [];
|
|
@@ -1871,26 +1847,20 @@ async function isentinel(options, ...userConfigs) {
|
|
|
1871
1847
|
isInEditor
|
|
1872
1848
|
}));
|
|
1873
1849
|
configs.push(disables({ root: rootGlobs }));
|
|
1874
|
-
if (stylisticOptions !== false) {
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
oxfmtConfigOptions,
|
|
1889
|
-
oxfmtOptions: formatterOptions.oxfmtOptions,
|
|
1890
|
-
prettierOptions: prettierSettings,
|
|
1891
|
-
tsFormatter
|
|
1892
|
-
}));
|
|
1893
|
-
}
|
|
1850
|
+
if (stylisticOptions !== false) configs.push(oxfmt({
|
|
1851
|
+
componentExts: componentExtensions,
|
|
1852
|
+
formatters: formatters !== false ? formatters : {
|
|
1853
|
+
css: false,
|
|
1854
|
+
graphql: false,
|
|
1855
|
+
html: false,
|
|
1856
|
+
json: false,
|
|
1857
|
+
markdown: false,
|
|
1858
|
+
yaml: false
|
|
1859
|
+
},
|
|
1860
|
+
oxfmtConfigOptions,
|
|
1861
|
+
oxfmtOptions: formatterOptions.oxfmtOptions,
|
|
1862
|
+
prettierOptions: prettierSettings
|
|
1863
|
+
}));
|
|
1894
1864
|
if ("files" in options) throw new Error("[@isentinel/eslint-config] The first argument should not contain the \"files\" property as the options are supposed to be global. Place it in the second or later config instead.");
|
|
1895
1865
|
const fusedConfig = flatConfigProps.reduce((accumulator, key) => {
|
|
1896
1866
|
if (key in options) accumulator[key] = options[key];
|
|
@@ -1920,7 +1890,16 @@ async function isentinel(options, ...userConfigs) {
|
|
|
1920
1890
|
//#endregion
|
|
1921
1891
|
//#region src/configs/oxfmt.ts
|
|
1922
1892
|
async function oxfmt(options) {
|
|
1923
|
-
const { componentExts: componentExtensions = [], files: oxfmtFiles,
|
|
1893
|
+
const { componentExts: componentExtensions = [], files: oxfmtFiles, formatters = {}, oxfmtConfigOptions = {}, oxfmtOptions: userOxfmtOptions, prettierOptions = {} } = options ?? {};
|
|
1894
|
+
const formattingOptions = {
|
|
1895
|
+
css: true,
|
|
1896
|
+
graphql: true,
|
|
1897
|
+
html: true,
|
|
1898
|
+
json: true,
|
|
1899
|
+
markdown: true,
|
|
1900
|
+
yaml: true,
|
|
1901
|
+
...resolveWithDefaults(formatters, {})
|
|
1902
|
+
};
|
|
1924
1903
|
const oxfmtOptions = {
|
|
1925
1904
|
sortImports: {
|
|
1926
1905
|
customGroups: [{
|
|
@@ -1953,6 +1932,7 @@ async function oxfmt(options) {
|
|
|
1953
1932
|
],
|
|
1954
1933
|
newlinesBetween: true
|
|
1955
1934
|
},
|
|
1935
|
+
sortPackageJson: false,
|
|
1956
1936
|
...migratePrettierOptions(prettierOptions),
|
|
1957
1937
|
...oxfmtConfigOptions,
|
|
1958
1938
|
...userOxfmtOptions
|
|
@@ -1965,45 +1945,90 @@ async function oxfmt(options) {
|
|
|
1965
1945
|
name: "isentinel/oxfmt/setup",
|
|
1966
1946
|
plugins: { oxfmt: pluginOxfmt }
|
|
1967
1947
|
}];
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
rules
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
}
|
|
2006
|
-
}
|
|
1948
|
+
const jsFiles = oxfmtFiles ?? [
|
|
1949
|
+
GLOB_JS,
|
|
1950
|
+
GLOB_JSX,
|
|
1951
|
+
`${GLOB_MARKDOWN}/${GLOB_JS}`,
|
|
1952
|
+
`${GLOB_MARKDOWN}/${GLOB_JSX}`
|
|
1953
|
+
];
|
|
1954
|
+
configs.push({
|
|
1955
|
+
name: "isentinel/oxfmt/javascript",
|
|
1956
|
+
files: jsFiles,
|
|
1957
|
+
rules: {
|
|
1958
|
+
...rules,
|
|
1959
|
+
"arrow-body-style": "off",
|
|
1960
|
+
"oxfmt/oxfmt": ["error", oxfmtOptions],
|
|
1961
|
+
"prefer-arrow-callback": "off"
|
|
1962
|
+
}
|
|
1963
|
+
});
|
|
1964
|
+
const tsFiles = oxfmtFiles ?? [
|
|
1965
|
+
GLOB_TS,
|
|
1966
|
+
GLOB_TSX,
|
|
1967
|
+
`${GLOB_MARKDOWN}/${GLOB_TS}`,
|
|
1968
|
+
`${GLOB_MARKDOWN}/${GLOB_TSX}`,
|
|
1969
|
+
...componentExtensions.map((extension) => `**/*.${extension}`)
|
|
1970
|
+
];
|
|
1971
|
+
configs.push({
|
|
1972
|
+
name: "isentinel/oxfmt/typescript",
|
|
1973
|
+
files: tsFiles,
|
|
1974
|
+
rules: {
|
|
1975
|
+
...rules,
|
|
1976
|
+
"arrow-body-style": "off",
|
|
1977
|
+
"oxfmt/oxfmt": ["error", oxfmtOptions],
|
|
1978
|
+
"prefer-arrow-callback": "off"
|
|
1979
|
+
}
|
|
1980
|
+
});
|
|
1981
|
+
if (formattingOptions.css) configs.push({
|
|
1982
|
+
name: "isentinel/oxfmt/css",
|
|
1983
|
+
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
1984
|
+
languageOptions: { parser: parserPlain },
|
|
1985
|
+
rules: { "oxfmt/oxfmt": ["error", oxfmtOptions] }
|
|
1986
|
+
}, {
|
|
1987
|
+
name: "isentinel/oxfmt/scss",
|
|
1988
|
+
files: [GLOB_SCSS],
|
|
1989
|
+
languageOptions: { parser: parserPlain },
|
|
1990
|
+
rules: { "oxfmt/oxfmt": ["error", oxfmtOptions] }
|
|
1991
|
+
}, {
|
|
1992
|
+
name: "isentinel/oxfmt/less",
|
|
1993
|
+
files: [GLOB_LESS],
|
|
1994
|
+
languageOptions: { parser: parserPlain },
|
|
1995
|
+
rules: { "oxfmt/oxfmt": ["error", oxfmtOptions] }
|
|
1996
|
+
});
|
|
1997
|
+
if (formattingOptions.html) configs.push({
|
|
1998
|
+
name: "isentinel/oxfmt/html",
|
|
1999
|
+
files: ["**/*.html"],
|
|
2000
|
+
languageOptions: { parser: parserPlain },
|
|
2001
|
+
rules: { "oxfmt/oxfmt": ["error", oxfmtOptions] }
|
|
2002
|
+
});
|
|
2003
|
+
if (formattingOptions.markdown) configs.push({
|
|
2004
|
+
name: "isentinel/oxfmt/markdown",
|
|
2005
|
+
files: [GLOB_MARKDOWN],
|
|
2006
|
+
rules: { "oxfmt/oxfmt": ["error", {
|
|
2007
|
+
...oxfmtOptions,
|
|
2008
|
+
printWidth: Number(prettierOptions["jsdocPrintWidth"]) || 80,
|
|
2009
|
+
proseWrap: "always"
|
|
2010
|
+
}] }
|
|
2011
|
+
});
|
|
2012
|
+
if (formattingOptions.graphql) configs.push({
|
|
2013
|
+
name: "isentinel/oxfmt/graphql",
|
|
2014
|
+
files: ["**/*.graphql"],
|
|
2015
|
+
languageOptions: { parser: parserPlain },
|
|
2016
|
+
rules: { "oxfmt/oxfmt": ["error", oxfmtOptions] }
|
|
2017
|
+
});
|
|
2018
|
+
if (formattingOptions.json) configs.push({
|
|
2019
|
+
name: "isentinel/oxfmt/json",
|
|
2020
|
+
files: [GLOB_ALL_JSON],
|
|
2021
|
+
rules: { "oxfmt/oxfmt": ["error", oxfmtOptions] }
|
|
2022
|
+
});
|
|
2023
|
+
if (formattingOptions.yaml) configs.push({
|
|
2024
|
+
name: "isentinel/oxfmt/yaml",
|
|
2025
|
+
files: [GLOB_YAML],
|
|
2026
|
+
rules: { "oxfmt/oxfmt": ["error", {
|
|
2027
|
+
...oxfmtOptions,
|
|
2028
|
+
tabWidth: 2,
|
|
2029
|
+
useTabs: false
|
|
2030
|
+
}] }
|
|
2031
|
+
});
|
|
2007
2032
|
return configs;
|
|
2008
2033
|
}
|
|
2009
2034
|
const UNSUPPORTED_PRETTIER_KEYS = new Set([
|
|
@@ -2260,119 +2285,6 @@ async function detectCatalogUsage() {
|
|
|
2260
2285
|
return yaml.includes("catalog:") || yaml.includes("catalogs:");
|
|
2261
2286
|
}
|
|
2262
2287
|
|
|
2263
|
-
//#endregion
|
|
2264
|
-
//#region src/configs/prettier.ts
|
|
2265
|
-
async function prettier(options) {
|
|
2266
|
-
const { componentExts: componentExtensions = [], files: prettierFiles, formatters = {}, jsFormatter = "oxfmt", prettierOptions = {}, tsFormatter = "oxfmt" } = options ?? {};
|
|
2267
|
-
const formattingOptions = {
|
|
2268
|
-
css: true,
|
|
2269
|
-
graphql: true,
|
|
2270
|
-
html: true,
|
|
2271
|
-
json: true,
|
|
2272
|
-
markdown: true,
|
|
2273
|
-
yaml: true,
|
|
2274
|
-
...resolveWithDefaults(formatters, {})
|
|
2275
|
-
};
|
|
2276
|
-
const [configPrettier, pluginPrettier] = await Promise.all([interopDefault(import("eslint-config-prettier/flat")), interopDefault(import("eslint-plugin-prettier"))]);
|
|
2277
|
-
const rulesToIgnore = ["curly", "style/quotes"];
|
|
2278
|
-
const rules = renameRules(configPrettier.rules, defaultPluginRenaming);
|
|
2279
|
-
for (const rule of rulesToIgnore) delete rules[rule];
|
|
2280
|
-
const configs = [{
|
|
2281
|
-
name: "isentinel/prettier/setup",
|
|
2282
|
-
plugins: { format: pluginPrettier }
|
|
2283
|
-
}];
|
|
2284
|
-
if (jsFormatter === "prettier") {
|
|
2285
|
-
const jsFiles = prettierFiles ?? [
|
|
2286
|
-
GLOB_JS,
|
|
2287
|
-
GLOB_JSX,
|
|
2288
|
-
`${GLOB_MARKDOWN}/${GLOB_JS}`,
|
|
2289
|
-
`${GLOB_MARKDOWN}/${GLOB_JSX}`
|
|
2290
|
-
];
|
|
2291
|
-
configs.push({
|
|
2292
|
-
name: "isentinel/prettier/javascript",
|
|
2293
|
-
files: jsFiles,
|
|
2294
|
-
rules: {
|
|
2295
|
-
...rules,
|
|
2296
|
-
"arrow-body-style": "off",
|
|
2297
|
-
"format/prettier": ["error", mergePrettierOptions(prettierOptions, {})],
|
|
2298
|
-
"prefer-arrow-callback": "off"
|
|
2299
|
-
}
|
|
2300
|
-
});
|
|
2301
|
-
}
|
|
2302
|
-
if (tsFormatter === "prettier") {
|
|
2303
|
-
const tsFiles = prettierFiles ?? [
|
|
2304
|
-
GLOB_TS,
|
|
2305
|
-
GLOB_TSX,
|
|
2306
|
-
`${GLOB_MARKDOWN}/${GLOB_TS}`,
|
|
2307
|
-
`${GLOB_MARKDOWN}/${GLOB_TSX}`,
|
|
2308
|
-
...componentExtensions.map((extension) => `**/*.${extension}`)
|
|
2309
|
-
];
|
|
2310
|
-
configs.push({
|
|
2311
|
-
name: "isentinel/prettier/typescript",
|
|
2312
|
-
files: tsFiles,
|
|
2313
|
-
rules: {
|
|
2314
|
-
...rules,
|
|
2315
|
-
"arrow-body-style": "off",
|
|
2316
|
-
"format/prettier": ["error", mergePrettierOptions(prettierOptions, {})],
|
|
2317
|
-
"prefer-arrow-callback": "off"
|
|
2318
|
-
}
|
|
2319
|
-
});
|
|
2320
|
-
}
|
|
2321
|
-
if (formattingOptions.css) configs.push({
|
|
2322
|
-
name: "isentinel/prettier/css",
|
|
2323
|
-
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
2324
|
-
languageOptions: { parser: parserPlain },
|
|
2325
|
-
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "css" })] }
|
|
2326
|
-
}, {
|
|
2327
|
-
name: "isentinel/prettier/scss",
|
|
2328
|
-
files: [GLOB_SCSS],
|
|
2329
|
-
languageOptions: { parser: parserPlain },
|
|
2330
|
-
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "scss" })] }
|
|
2331
|
-
}, {
|
|
2332
|
-
name: "isentinel/prettier/less",
|
|
2333
|
-
files: [GLOB_LESS],
|
|
2334
|
-
languageOptions: { parser: parserPlain },
|
|
2335
|
-
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "less" })] }
|
|
2336
|
-
});
|
|
2337
|
-
if (formattingOptions.html) configs.push({
|
|
2338
|
-
name: "isentinel/prettier/html",
|
|
2339
|
-
files: ["**/*.html"],
|
|
2340
|
-
languageOptions: { parser: parserPlain },
|
|
2341
|
-
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "html" })] }
|
|
2342
|
-
});
|
|
2343
|
-
if (formattingOptions.markdown) configs.push({
|
|
2344
|
-
name: "isentinel/prettier/markdown",
|
|
2345
|
-
files: [GLOB_MARKDOWN],
|
|
2346
|
-
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, {
|
|
2347
|
-
embeddedLanguageFormatting: "auto",
|
|
2348
|
-
parser: "markdown",
|
|
2349
|
-
printWidth: Number(prettierOptions["jsdocPrintWidth"]) || 80,
|
|
2350
|
-
proseWrap: "always"
|
|
2351
|
-
})] }
|
|
2352
|
-
});
|
|
2353
|
-
if (formattingOptions.graphql) configs.push({
|
|
2354
|
-
name: "isentinel/prettier/graphql",
|
|
2355
|
-
files: ["**/*.graphql"],
|
|
2356
|
-
languageOptions: { parser: parserPlain },
|
|
2357
|
-
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "graphql" })] }
|
|
2358
|
-
});
|
|
2359
|
-
if (formattingOptions.json) configs.push({
|
|
2360
|
-
name: "isentinel/prettier/json",
|
|
2361
|
-
files: [GLOB_ALL_JSON],
|
|
2362
|
-
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "json" })] }
|
|
2363
|
-
});
|
|
2364
|
-
if (formattingOptions.yaml) configs.push({
|
|
2365
|
-
name: "isentinel/prettier/yaml",
|
|
2366
|
-
files: [GLOB_YAML],
|
|
2367
|
-
rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, {
|
|
2368
|
-
parser: "yaml",
|
|
2369
|
-
tabWidth: 2,
|
|
2370
|
-
useTabs: false
|
|
2371
|
-
})] }
|
|
2372
|
-
});
|
|
2373
|
-
return configs;
|
|
2374
|
-
}
|
|
2375
|
-
|
|
2376
2288
|
//#endregion
|
|
2377
2289
|
//#region src/configs/promise.ts
|
|
2378
2290
|
async function promise() {
|
|
@@ -3324,7 +3236,7 @@ async function stylistic(options = {}, prettierOptions = {}) {
|
|
|
3324
3236
|
maxObjectProperties: 2,
|
|
3325
3237
|
namedExportsAlwaysUseExplicitReturn: true,
|
|
3326
3238
|
objectReturnStyle: "complex-explicit",
|
|
3327
|
-
usePrettier:
|
|
3239
|
+
usePrettier: prettierOptions
|
|
3328
3240
|
}] };
|
|
3329
3241
|
}
|
|
3330
3242
|
return [
|
|
@@ -3561,7 +3473,10 @@ async function test(options = {}) {
|
|
|
3561
3473
|
"vitest/no-standalone-expect": "error",
|
|
3562
3474
|
"vitest/no-test-prefixes": "error",
|
|
3563
3475
|
"vitest/no-test-return-statement": "error",
|
|
3476
|
+
"vitest/no-unneeded-async-expect-function": "error",
|
|
3564
3477
|
"vitest/prefer-called-exactly-once-with": "warn",
|
|
3478
|
+
"vitest/prefer-called-once": "error",
|
|
3479
|
+
"vitest/prefer-called-with": "error",
|
|
3565
3480
|
"vitest/prefer-comparison-matcher": "warn",
|
|
3566
3481
|
"vitest/prefer-describe-function-title": "warn",
|
|
3567
3482
|
"vitest/prefer-each": "warn",
|
|
@@ -3583,6 +3498,8 @@ async function test(options = {}) {
|
|
|
3583
3498
|
"vitest/prefer-to-be": "error",
|
|
3584
3499
|
"vitest/prefer-to-be-object": "error",
|
|
3585
3500
|
"vitest/prefer-to-contain": "error",
|
|
3501
|
+
"vitest/prefer-to-have-been-called-times": "error",
|
|
3502
|
+
"vitest/prefer-to-have-length": "error",
|
|
3586
3503
|
"vitest/prefer-todo": "warn",
|
|
3587
3504
|
"vitest/prefer-vi-mocked": "error",
|
|
3588
3505
|
"vitest/require-awaited-expect-poll": "error",
|
|
@@ -4004,4 +3921,4 @@ async function yaml(options = {}) {
|
|
|
4004
3921
|
}
|
|
4005
3922
|
|
|
4006
3923
|
//#endregion
|
|
4007
|
-
export { GLOB_ALL_JSON, GLOB_ALL_SRC, GLOB_BUILD_TOOLS, GLOB_CSS, GLOB_DTS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LUA, GLOB_MARKDOWN, GLOB_MARKDOWN_BLOCKS, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_ROOT, GLOB_ROOT_SRC, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_XML, GLOB_YAML, StylisticConfigDefaults, ceaseNonsense, comments, isentinel as default, isentinel, defaultPluginRenaming, disables, eslintPlugin, flawless, gitignore, ignores, imports, javascript, jsdoc, jsonc, markdown, node, oxfmt, packageJson, perfectionist, pnpm,
|
|
3924
|
+
export { GLOB_ALL_JSON, GLOB_ALL_SRC, GLOB_BUILD_TOOLS, GLOB_CSS, GLOB_DTS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LUA, GLOB_MARKDOWN, GLOB_MARKDOWN_BLOCKS, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_ROOT, GLOB_ROOT_SRC, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_XML, GLOB_YAML, StylisticConfigDefaults, ceaseNonsense, comments, isentinel as default, isentinel, defaultPluginRenaming, disables, eslintPlugin, flawless, gitignore, ignores, imports, javascript, jsdoc, jsonc, markdown, node, oxfmt, packageJson, perfectionist, pnpm, promise, react, roblox, sonarjs, sortGithubAction, sortPnpmWorkspace, sortRojoProject, sortTsconfig, spelling, stylistic, test, toml, typescript, unicorn, yaml };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@isentinel/eslint-config",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.2",
|
|
4
4
|
"description": "iSentinel's ESLint config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint-config",
|
|
@@ -81,7 +81,6 @@
|
|
|
81
81
|
"eslint-plugin-package-json": "0.89.1",
|
|
82
82
|
"eslint-plugin-perfectionist": "5.6.0",
|
|
83
83
|
"eslint-plugin-pnpm": "1.5.0",
|
|
84
|
-
"eslint-plugin-prettier": "5.5.5",
|
|
85
84
|
"eslint-plugin-promise": "7.2.1",
|
|
86
85
|
"eslint-plugin-roblox-ts": "1.4.0",
|
|
87
86
|
"eslint-plugin-sentinel": "0.1.2",
|
|
@@ -96,7 +95,6 @@
|
|
|
96
95
|
"local-pkg": "1.1.2",
|
|
97
96
|
"oxfmt": "0.35.0",
|
|
98
97
|
"prettier": "3.8.1",
|
|
99
|
-
"prettier-plugin-jsdoc": "1.8.0",
|
|
100
98
|
"toml-eslint-parser": "1.0.3",
|
|
101
99
|
"yaml-eslint-parser": "2.0.0",
|
|
102
100
|
"yargs": "18.0.0"
|
|
@@ -133,7 +131,7 @@
|
|
|
133
131
|
"type-fest": "5.4.4",
|
|
134
132
|
"typescript": "5.9.3",
|
|
135
133
|
"unplugin-unused": "0.5.7",
|
|
136
|
-
"@isentinel/eslint-config": "5.0.0-beta.
|
|
134
|
+
"@isentinel/eslint-config": "5.0.0-beta.2"
|
|
137
135
|
},
|
|
138
136
|
"peerDependencies": {
|
|
139
137
|
"@vitest/eslint-plugin": "^1.6.4",
|