@isentinel/eslint-config 6.0.1 → 6.2.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/README.md +115 -0
- package/dist/cli.mjs +231 -30
- package/dist/index.d.mts +84 -36
- package/dist/index.mjs +793 -200
- package/dist/lint-cli.mjs +527 -131
- package/dist/oxfmt.d.mts +132 -0
- package/dist/oxfmt.mjs +722 -0
- package/dist/oxlint.d.mts +21 -2
- package/dist/oxlint.mjs +462 -61
- package/package.json +10 -5
package/dist/oxfmt.d.mts
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { FormatConfig, JsdocConfig, OxfmtConfig, OxfmtConfig as OxfmtConfig$1 } from "oxfmt";
|
|
2
|
+
import "@stylistic/eslint-plugin";
|
|
3
|
+
import "eslint";
|
|
4
|
+
import { Options } from "prettier";
|
|
5
|
+
import "@typescript-eslint/parser";
|
|
6
|
+
import "eslint-config-flat-gitignore";
|
|
7
|
+
import "type-fest";
|
|
8
|
+
import "eslint-flat-config-utils";
|
|
9
|
+
//#region src/utils.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* Oxfmt's generated types widen `jsdoc.commentLineStrategy` and
|
|
12
|
+
* `jsdoc.lineWrappingStyle` to `string`, but its JSON schema (and therefore the
|
|
13
|
+
* generated `oxfmt/oxfmt` rule type) keep them as literal enums. Re-narrow them
|
|
14
|
+
* so option objects remain assignable to the rule.
|
|
15
|
+
*/
|
|
16
|
+
type OxfmtOptions = Omit<FormatConfig, "jsdoc"> & {
|
|
17
|
+
jsdoc?: boolean | (Omit<JsdocConfig, "commentLineStrategy" | "lineWrappingStyle"> & {
|
|
18
|
+
commentLineStrategy?: "keep" | "multiline" | "singleLine";
|
|
19
|
+
lineWrappingStyle?: "balance" | "greedy";
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/types.d.ts
|
|
24
|
+
interface OptionsFormatters {
|
|
25
|
+
/**
|
|
26
|
+
* Enable formatting support for CSS, Less, Sass, and SCSS.
|
|
27
|
+
*
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
css?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Enable formatting support for GraphQL.
|
|
33
|
+
*
|
|
34
|
+
* @default true
|
|
35
|
+
*/
|
|
36
|
+
graphql?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Enable formatting support for HTML.
|
|
39
|
+
*
|
|
40
|
+
* @default true
|
|
41
|
+
*/
|
|
42
|
+
html?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Enable formatting support for JSON(C|5).
|
|
45
|
+
*
|
|
46
|
+
* @default true
|
|
47
|
+
*/
|
|
48
|
+
json?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Enable formatting support for Lua files (powered by stylua).
|
|
51
|
+
*
|
|
52
|
+
* @default true
|
|
53
|
+
*/
|
|
54
|
+
lua?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Enable formatting support for Markdown.
|
|
57
|
+
*
|
|
58
|
+
* @default true
|
|
59
|
+
*/
|
|
60
|
+
markdown?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Custom options for oxfmt. Takes precedence over options migrated from
|
|
63
|
+
* prettier.
|
|
64
|
+
*/
|
|
65
|
+
oxfmtOptions?: OxfmtOptions;
|
|
66
|
+
/**
|
|
67
|
+
* Custom options for Prettier.
|
|
68
|
+
*
|
|
69
|
+
* Used for flawless/arrow-return-style and as a migration source for oxfmt
|
|
70
|
+
* options.
|
|
71
|
+
*/
|
|
72
|
+
prettierOptions?: Options;
|
|
73
|
+
/**
|
|
74
|
+
* Enable formatting support for YAML.
|
|
75
|
+
*
|
|
76
|
+
* @default true
|
|
77
|
+
*/
|
|
78
|
+
yaml?: boolean;
|
|
79
|
+
}
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region src/formatted-files.d.ts
|
|
82
|
+
/** The languages `formatters` turns on and off. */
|
|
83
|
+
type FormattedLanguages = Pick<OptionsFormatters, "css" | "graphql" | "html" | "json" | "markdown" | "yaml">;
|
|
84
|
+
/** Which files are formatted. */
|
|
85
|
+
interface FormattedFilesOptions {
|
|
86
|
+
/** Component extensions formatted with TypeScript, without the dot. */
|
|
87
|
+
componentExts?: Array<string>;
|
|
88
|
+
/**
|
|
89
|
+
* Languages to format besides JS and TS; `false` formats JS and TS only.
|
|
90
|
+
* Default `true`.
|
|
91
|
+
*/
|
|
92
|
+
formatters?: boolean | FormattedLanguages;
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region src/oxfmt/index.d.ts
|
|
96
|
+
/**
|
|
97
|
+
* Options for {@link isentinelOxfmt}: an oxfmt config, plus the preset's own.
|
|
98
|
+
*/
|
|
99
|
+
type IsentinelOxfmtOptions = FormattedFilesOptions & OxfmtConfig$1 & {
|
|
100
|
+
/** Directory to resolve `.prettierrc` and `.editorconfig` from. */
|
|
101
|
+
cwd?: string;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Build the preset's oxfmt config.
|
|
105
|
+
*
|
|
106
|
+
* Root format options start from the same defaults the ESLint and oxlint
|
|
107
|
+
* factories use (preset defaults < `.editorconfig` < `.prettierrc`), and every
|
|
108
|
+
* key in `config` replaces its base value. `ignorePatterns` and `overrides`
|
|
109
|
+
* are the exception: the user's entries are appended to the preset's, so a
|
|
110
|
+
* user override wins over the preset's Markdown, YAML and JSON5 overrides.
|
|
111
|
+
* The `.prettierrc` overrides come last, as in ESLint mode. Slash-less
|
|
112
|
+
* override globs are anchored to the config directory (`*.json` becomes
|
|
113
|
+
* `./*.json`), so they match the files the ESLint rule matches.
|
|
114
|
+
*
|
|
115
|
+
* Oxfmt formats the files ESLint mode formats, and no others: TOML, `.mdx` and
|
|
116
|
+
* the like stay as they are.
|
|
117
|
+
*
|
|
118
|
+
* @param config - Options that replace the preset's, plus extra ignore
|
|
119
|
+
* patterns and overrides.
|
|
120
|
+
* @param config.componentExts - Component extensions to format, as the
|
|
121
|
+
* factories' `componentExts`.
|
|
122
|
+
* @param config.cwd - Directory to resolve `.prettierrc` and `.editorconfig`
|
|
123
|
+
* from (default `process.cwd()`).
|
|
124
|
+
* @param config.formatters - Languages to format besides JS and TS, as the
|
|
125
|
+
* factories' `formatters`.
|
|
126
|
+
* @param config.ignorePatterns - Appended to the preset's ignore patterns.
|
|
127
|
+
* @param config.overrides - Appended to the preset's overrides.
|
|
128
|
+
* @returns The oxfmt config.
|
|
129
|
+
*/
|
|
130
|
+
declare function isentinelOxfmt({ componentExts, cwd, formatters, ignorePatterns, overrides, ...rest }?: IsentinelOxfmtOptions): OxfmtConfig$1;
|
|
131
|
+
//#endregion
|
|
132
|
+
export { IsentinelOxfmtOptions, type OxfmtConfig, isentinelOxfmt };
|