@kazupon/eslint-config 0.9.0 → 0.10.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 CHANGED
@@ -20,6 +20,7 @@ ESLint config for @kazupon
20
20
  - `jsonc`
21
21
  - `vue`,
22
22
  - `yml`
23
+ - `toml`
23
24
  - Support primitive eslint flat configuration
24
25
  - Support overrides for built-in configurations
25
26
  - `rules`
@@ -87,7 +88,7 @@ Add the following settings to your `.vscode/settings.json`:
87
88
  "source.fixAll.eslint": "explicit"
88
89
  },
89
90
  // Enable eslint for supported languages
90
- "eslint.validate": ["javascript", "typescript", "json", "jsonc", "json5", "vue", "yaml"],
91
+ "eslint.validate": ["javascript", "typescript", "json", "jsonc", "json5", "vue", "yaml", "toml"],
91
92
  // Enable flat configuration
92
93
  "eslint.useFlatConfig": true
93
94
  }
@@ -110,6 +111,7 @@ The following built-in configurations are supported:
110
111
  | `jsonc` | [`eslint-plugin-jsonc`](https://www.npmjs.com/package/eslint-plugin-jsonc) | yes |
111
112
  | `vue` | [`eslint-plugin-vue`](https://www.npmjs.com/package/eslint-plugin-vue) | yes |
112
113
  | `yml` | [`eslint-plugin-yml`](https://www.npmjs.com/package/eslint-plugin-yml) | yes |
114
+ | `toml` | [`eslint-plugin-toml`](https://www.npmjs.com/package/eslint-plugin-toml) | yes |
113
115
 
114
116
  You can use `import` syntax:
115
117
 
@@ -4,6 +4,7 @@ export * from './typescript';
4
4
  export * from './jsdoc';
5
5
  export * from './promise';
6
6
  export * from './regexp';
7
+ export * from './toml';
7
8
  export * from './unicorn';
8
9
  export * from './prettier';
9
10
  export * from './jsonc';
@@ -4,6 +4,7 @@ export * from './typescript';
4
4
  export * from './jsdoc';
5
5
  export * from './promise';
6
6
  export * from './regexp';
7
+ export * from './toml';
7
8
  export * from './unicorn';
8
9
  export * from './prettier';
9
10
  export * from './jsonc';
@@ -0,0 +1,15 @@
1
+ import type { Linter } from 'eslint';
2
+ import type { OverridesOptions, TomlRules } from '../types';
3
+ /**
4
+ * eslint toml configuration options
5
+ */
6
+ export interface TomlOptions {
7
+ }
8
+ /**
9
+ * `eslint-plugin-yml` and overrides configuration options
10
+ * @param {YmlOptions & OverridesOptions} options
11
+ * eslint yml configuration options for yml, yaml
12
+ * @returns {Promise<Linter.FlatConfig[]>}
13
+ * eslint flat configurations with `eslint-plugin-yml` and overrides
14
+ */
15
+ export declare function toml(options?: TomlOptions & OverridesOptions<TomlRules>): Promise<Linter.FlatConfig[]>;
@@ -0,0 +1,15 @@
1
+ import type { Linter } from 'eslint';
2
+ import type { OverridesOptions, TomlRules } from '../types';
3
+ /**
4
+ * eslint toml configuration options
5
+ */
6
+ export interface TomlOptions {
7
+ }
8
+ /**
9
+ * `eslint-plugin-yml` and overrides configuration options
10
+ * @param {YmlOptions & OverridesOptions} options
11
+ * eslint yml configuration options for yml, yaml
12
+ * @returns {Promise<Linter.FlatConfig[]>}
13
+ * eslint flat configurations with `eslint-plugin-yml` and overrides
14
+ */
15
+ export declare function toml(options?: TomlOptions & OverridesOptions<TomlRules>): Promise<Linter.FlatConfig[]>;
package/dist/globs.d.cts CHANGED
@@ -6,4 +6,5 @@ export declare const GLOB_JSON = "**/*.json";
6
6
  export declare const GLOB_JSON5 = "**/*.json5";
7
7
  export declare const GLOB_JSONC = "**/*.jsonc";
8
8
  export declare const GLOB_YAML = "**/*.y?(a)ml";
9
+ export declare const GLOB_TOML = "**/*.toml";
9
10
  export declare const GLOB_VUE = "**/*.vue";
package/dist/globs.d.ts CHANGED
@@ -6,4 +6,5 @@ export declare const GLOB_JSON = "**/*.json";
6
6
  export declare const GLOB_JSON5 = "**/*.json5";
7
7
  export declare const GLOB_JSONC = "**/*.jsonc";
8
8
  export declare const GLOB_YAML = "**/*.y?(a)ml";
9
+ export declare const GLOB_TOML = "**/*.toml";
9
10
  export declare const GLOB_VUE = "**/*.vue";
package/dist/index.cjs CHANGED
@@ -103,6 +103,7 @@ const GLOB_JSON = '**/*.json';
103
103
  const GLOB_JSON5 = '**/*.json5';
104
104
  const GLOB_JSONC = '**/*.jsonc';
105
105
  const GLOB_YAML = '**/*.y?(a)ml';
106
+ const GLOB_TOML = '**/*.toml';
106
107
  const GLOB_VUE = '**/*.vue';
107
108
 
108
109
  //#endregion
@@ -112,7 +113,7 @@ async function typescript(options = {}) {
112
113
  const ts = await loadPlugin('typescript-eslint');
113
114
  const files = options.files ?? [GLOB_TS, GLOB_TSX, ...extraFileExtensions.map((ext) => `**/*${ext}`)];
114
115
  return [...(ts.configs.recommendedTypeChecked), {
115
- files: [GLOB_JS, GLOB_JSX, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_YAML],
116
+ files: [GLOB_JS, GLOB_JSX, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_YAML, GLOB_TOML],
116
117
  ...(ts.configs.disableTypeChecked)
117
118
  }, {
118
119
  name: '@kazupon/typescipt/typescript-eslint',
@@ -191,6 +192,27 @@ async function regexp(options = {}) {
191
192
  }];
192
193
  }
193
194
 
195
+ //#endregion
196
+ //#region src/configs/toml.ts
197
+ async function toml(options = {}) {
198
+ const { rules: overrideRules = {} } = options;
199
+ const toml$1 = await loadPlugin('eslint-plugin-toml');
200
+ const configs = [];
201
+ configs.push(...toml$1.configs['flat/standard'].map((config, index) => {
202
+ return config.name ? config : {
203
+ name: `toml/flat/standard/${index}`,
204
+ ...config
205
+ };
206
+ }));
207
+ const overriddenConfig = {
208
+ name: '@kazupon/toml',
209
+ files: [GLOB_TOML],
210
+ rules: {...overrideRules}
211
+ };
212
+ configs.push(overriddenConfig);
213
+ return configs;
214
+ }
215
+
194
216
  //#endregion
195
217
  //#region src/configs/unicorn.ts
196
218
  async function unicorn(options = {}) {
@@ -221,12 +243,6 @@ async function jsonc(options = {}) {
221
243
  const usePrettier = !!options.prettier;
222
244
  const jsonc$1 = await loadPlugin('eslint-plugin-jsonc');
223
245
  const configs = [];
224
- const defaultRules = {'jsonc/sort-keys': ['warn', 'asc', {
225
- caseSensitive: true,
226
- natural: false,
227
- minKeys: 2,
228
- allowLineSeparatedGroups: false
229
- }]};
230
246
  for (const kind of kinds) {
231
247
  if (kind) {
232
248
  configs.push(...jsonc$1.configs[`flat/recommended-with-${kind}`].map((config, index) => {
@@ -248,14 +264,33 @@ async function jsonc(options = {}) {
248
264
  const overriddenConfig = {
249
265
  name: '@kazupon/jsonc',
250
266
  files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
251
- rules: {
252
- ...defaultRules,
253
- ...overrideRules
254
- }
267
+ rules: {...overrideRules}
255
268
  };
256
- configs.push(overriddenConfig);
269
+ configs.push(...jsoncSort(), overriddenConfig);
257
270
  return configs;
258
271
  }
272
+ function jsoncSort() {
273
+ return [{
274
+ name: '@kazupon/jsonc/sort/package.json',
275
+ files: ['**/package.json'],
276
+ rules: {
277
+ 'jsonc/sort-array-values': ['error', {
278
+ order: {type: 'asc'},
279
+ pathPattern: '^files$'
280
+ }],
281
+ 'jsonc/sort-keys': ['error', {
282
+ order: ['name', 'description', 'private', 'version', 'author', 'contributors', 'license', 'funding', 'bugs', 'repository', 'keywords', 'homepage', 'publishConfig', 'packageManager', 'engines', 'os', 'cpu', 'type', 'main', 'module', 'browser', 'unpkg', 'jsdelivr', 'sideEffects', 'bin', 'files', 'directories', 'exports', 'types', 'typesVersions', 'scripts', 'dependencies', 'peerDependencies', 'peerDependenciesMeta', 'optionalDependencies', 'devDependencies', 'pnpm', 'overrides', 'resolutions', 'workspaces', 'prettier', 'buildOPtions', 'lint-staged'],
283
+ pathPattern: '^$'
284
+ }, {
285
+ order: {type: 'asc'},
286
+ pathPattern: '^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$'
287
+ }, {
288
+ order: {type: 'asc'},
289
+ pathPattern: '^(?:resolutions|overrides|pnpm.overrides)$'
290
+ }]
291
+ }
292
+ }];
293
+ }
259
294
 
260
295
  //#endregion
261
296
  //#region src/configs/yml.ts
@@ -329,6 +364,7 @@ exports.jsonc = jsonc;
329
364
  exports.prettier = prettier;
330
365
  exports.promise = promise;
331
366
  exports.regexp = regexp;
367
+ exports.toml = toml;
332
368
  exports.typescript = typescript;
333
369
  exports.unicorn = unicorn;
334
370
  exports.vue = vue;
package/dist/index.js CHANGED
@@ -78,6 +78,7 @@ const GLOB_JSON = '**/*.json';
78
78
  const GLOB_JSON5 = '**/*.json5';
79
79
  const GLOB_JSONC = '**/*.jsonc';
80
80
  const GLOB_YAML = '**/*.y?(a)ml';
81
+ const GLOB_TOML = '**/*.toml';
81
82
  const GLOB_VUE = '**/*.vue';
82
83
 
83
84
  //#endregion
@@ -87,7 +88,7 @@ async function typescript(options = {}) {
87
88
  const ts = await loadPlugin('typescript-eslint');
88
89
  const files = options.files ?? [GLOB_TS, GLOB_TSX, ...extraFileExtensions.map((ext) => `**/*${ext}`)];
89
90
  return [...(ts.configs.recommendedTypeChecked), {
90
- files: [GLOB_JS, GLOB_JSX, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_YAML],
91
+ files: [GLOB_JS, GLOB_JSX, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_YAML, GLOB_TOML],
91
92
  ...(ts.configs.disableTypeChecked)
92
93
  }, {
93
94
  name: '@kazupon/typescipt/typescript-eslint',
@@ -166,6 +167,27 @@ async function regexp(options = {}) {
166
167
  }];
167
168
  }
168
169
 
170
+ //#endregion
171
+ //#region src/configs/toml.ts
172
+ async function toml(options = {}) {
173
+ const { rules: overrideRules = {} } = options;
174
+ const toml$1 = await loadPlugin('eslint-plugin-toml');
175
+ const configs = [];
176
+ configs.push(...toml$1.configs['flat/standard'].map((config, index) => {
177
+ return config.name ? config : {
178
+ name: `toml/flat/standard/${index}`,
179
+ ...config
180
+ };
181
+ }));
182
+ const overriddenConfig = {
183
+ name: '@kazupon/toml',
184
+ files: [GLOB_TOML],
185
+ rules: {...overrideRules}
186
+ };
187
+ configs.push(overriddenConfig);
188
+ return configs;
189
+ }
190
+
169
191
  //#endregion
170
192
  //#region src/configs/unicorn.ts
171
193
  async function unicorn(options = {}) {
@@ -196,12 +218,6 @@ async function jsonc(options = {}) {
196
218
  const usePrettier = !!options.prettier;
197
219
  const jsonc$1 = await loadPlugin('eslint-plugin-jsonc');
198
220
  const configs = [];
199
- const defaultRules = {'jsonc/sort-keys': ['warn', 'asc', {
200
- caseSensitive: true,
201
- natural: false,
202
- minKeys: 2,
203
- allowLineSeparatedGroups: false
204
- }]};
205
221
  for (const kind of kinds) {
206
222
  if (kind) {
207
223
  configs.push(...jsonc$1.configs[`flat/recommended-with-${kind}`].map((config, index) => {
@@ -223,14 +239,33 @@ async function jsonc(options = {}) {
223
239
  const overriddenConfig = {
224
240
  name: '@kazupon/jsonc',
225
241
  files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
226
- rules: {
227
- ...defaultRules,
228
- ...overrideRules
229
- }
242
+ rules: {...overrideRules}
230
243
  };
231
- configs.push(overriddenConfig);
244
+ configs.push(...jsoncSort(), overriddenConfig);
232
245
  return configs;
233
246
  }
247
+ function jsoncSort() {
248
+ return [{
249
+ name: '@kazupon/jsonc/sort/package.json',
250
+ files: ['**/package.json'],
251
+ rules: {
252
+ 'jsonc/sort-array-values': ['error', {
253
+ order: {type: 'asc'},
254
+ pathPattern: '^files$'
255
+ }],
256
+ 'jsonc/sort-keys': ['error', {
257
+ order: ['name', 'description', 'private', 'version', 'author', 'contributors', 'license', 'funding', 'bugs', 'repository', 'keywords', 'homepage', 'publishConfig', 'packageManager', 'engines', 'os', 'cpu', 'type', 'main', 'module', 'browser', 'unpkg', 'jsdelivr', 'sideEffects', 'bin', 'files', 'directories', 'exports', 'types', 'typesVersions', 'scripts', 'dependencies', 'peerDependencies', 'peerDependenciesMeta', 'optionalDependencies', 'devDependencies', 'pnpm', 'overrides', 'resolutions', 'workspaces', 'prettier', 'buildOPtions', 'lint-staged'],
258
+ pathPattern: '^$'
259
+ }, {
260
+ order: {type: 'asc'},
261
+ pathPattern: '^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$'
262
+ }, {
263
+ order: {type: 'asc'},
264
+ pathPattern: '^(?:resolutions|overrides|pnpm.overrides)$'
265
+ }]
266
+ }
267
+ }];
268
+ }
234
269
 
235
270
  //#endregion
236
271
  //#region src/configs/yml.ts
@@ -295,4 +330,4 @@ async function vue(options = {}) {
295
330
  }
296
331
 
297
332
  //#endregion
298
- export { comments, defineConfig, javascript, jsdoc, jsonc, prettier, promise, regexp, typescript, unicorn, vue, yaml, yml };
333
+ export { comments, defineConfig, javascript, jsdoc, jsonc, prettier, promise, regexp, toml, typescript, unicorn, vue, yaml, yml };
@@ -5,13 +5,14 @@ import type { JsoncRules } from './jsonc';
5
5
  import type { PrettierRules } from './prettier';
6
6
  import type { PromiseRules } from './promise';
7
7
  import type { RegexpRules } from './regexp';
8
+ import type { TomlRules } from './toml';
8
9
  import type { TypescriptRules } from './typescript';
9
10
  import type { UnicornRules } from './unicorn';
10
11
  import type { VueRules } from './vue';
11
12
  import type { YmlRules } from './yml';
12
13
  declare module 'eslint' {
13
14
  namespace Linter {
14
- interface RulesRecord extends CommentsRules, JavascriptRules, JsdocRules, JsoncRules, PrettierRules, PromiseRules, RegexpRules, TypescriptRules, UnicornRules, VueRules, YmlRules {
15
+ interface RulesRecord extends CommentsRules, JavascriptRules, JsdocRules, JsoncRules, PrettierRules, PromiseRules, RegexpRules, TomlRules, TypescriptRules, UnicornRules, VueRules, YmlRules {
15
16
  }
16
17
  }
17
18
  }
@@ -5,13 +5,14 @@ import type { JsoncRules } from './jsonc';
5
5
  import type { PrettierRules } from './prettier';
6
6
  import type { PromiseRules } from './promise';
7
7
  import type { RegexpRules } from './regexp';
8
+ import type { TomlRules } from './toml';
8
9
  import type { TypescriptRules } from './typescript';
9
10
  import type { UnicornRules } from './unicorn';
10
11
  import type { VueRules } from './vue';
11
12
  import type { YmlRules } from './yml';
12
13
  declare module 'eslint' {
13
14
  namespace Linter {
14
- interface RulesRecord extends CommentsRules, JavascriptRules, JsdocRules, JsoncRules, PrettierRules, PromiseRules, RegexpRules, TypescriptRules, UnicornRules, VueRules, YmlRules {
15
+ interface RulesRecord extends CommentsRules, JavascriptRules, JsdocRules, JsoncRules, PrettierRules, PromiseRules, RegexpRules, TomlRules, TypescriptRules, UnicornRules, VueRules, YmlRules {
15
16
  }
16
17
  }
17
18
  }
@@ -0,0 +1,256 @@
1
+ import type { Linter } from 'eslint';
2
+ export interface TomlRules {
3
+ /**
4
+ * enforce linebreaks after opening and before closing array brackets
5
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/array-bracket-newline.html
6
+ */
7
+ 'toml/array-bracket-newline'?: Linter.RuleEntry<TomlArrayBracketNewline>;
8
+ /**
9
+ * enforce consistent spacing inside array brackets
10
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/array-bracket-spacing.html
11
+ */
12
+ 'toml/array-bracket-spacing'?: Linter.RuleEntry<TomlArrayBracketSpacing>;
13
+ /**
14
+ * enforce line breaks between array elements
15
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/array-element-newline.html
16
+ */
17
+ 'toml/array-element-newline'?: Linter.RuleEntry<TomlArrayElementNewline>;
18
+ /**
19
+ * enforce consistent comma style in array
20
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/comma-style.html
21
+ */
22
+ 'toml/comma-style'?: Linter.RuleEntry<TomlCommaStyle>;
23
+ /**
24
+ * enforce consistent indentation
25
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/indent.html
26
+ */
27
+ 'toml/indent'?: Linter.RuleEntry<TomlIndent>;
28
+ /**
29
+ * enforce consistent spacing inside braces
30
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/inline-table-curly-spacing.html
31
+ */
32
+ 'toml/inline-table-curly-spacing'?: Linter.RuleEntry<TomlInlineTableCurlySpacing>;
33
+ /**
34
+ * enforce consistent spacing between keys and values in key/value pairs
35
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/key-spacing.html
36
+ */
37
+ 'toml/key-spacing'?: Linter.RuleEntry<TomlKeySpacing>;
38
+ /**
39
+ * disallow defining pair keys out-of-order
40
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/keys-order.html
41
+ */
42
+ 'toml/keys-order'?: Linter.RuleEntry<[]>;
43
+ /**
44
+ * disallow mixed data types in array
45
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/no-mixed-type-in-array.html
46
+ */
47
+ 'toml/no-mixed-type-in-array'?: Linter.RuleEntry<TomlNoMixedTypeInArray>;
48
+ /**
49
+ * disallow hexadecimal, octal and binary integer
50
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/no-non-decimal-integer.html
51
+ */
52
+ 'toml/no-non-decimal-integer'?: Linter.RuleEntry<TomlNoNonDecimalInteger>;
53
+ /**
54
+ * disallow spacing around infix operators
55
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/no-space-dots.html
56
+ */
57
+ 'toml/no-space-dots'?: Linter.RuleEntry<[]>;
58
+ /**
59
+ * disallow number separators that to not enhance readability.
60
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/no-unreadable-number-separator.html
61
+ */
62
+ 'toml/no-unreadable-number-separator'?: Linter.RuleEntry<[]>;
63
+ /**
64
+ * require or disallow padding lines between pairs
65
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/padding-line-between-pairs.html
66
+ */
67
+ 'toml/padding-line-between-pairs'?: Linter.RuleEntry<[]>;
68
+ /**
69
+ * require or disallow padding lines between tables
70
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/padding-line-between-tables.html
71
+ */
72
+ 'toml/padding-line-between-tables'?: Linter.RuleEntry<[]>;
73
+ /**
74
+ * disallow precision of fractional seconds greater than the specified value.
75
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/precision-of-fractional-seconds.html
76
+ */
77
+ 'toml/precision-of-fractional-seconds'?: Linter.RuleEntry<TomlPrecisionOfFractionalSeconds>;
78
+ /**
79
+ * disallow precision of integer greater than the specified value.
80
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/precision-of-integer.html
81
+ */
82
+ 'toml/precision-of-integer'?: Linter.RuleEntry<TomlPrecisionOfInteger>;
83
+ /**
84
+ * require or disallow quotes around keys
85
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/quoted-keys.html
86
+ */
87
+ 'toml/quoted-keys'?: Linter.RuleEntry<TomlQuotedKeys>;
88
+ /**
89
+ * require spacing around equals sign
90
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/space-eq-sign.html
91
+ * @deprecated
92
+ */
93
+ 'toml/space-eq-sign'?: Linter.RuleEntry<[]>;
94
+ /**
95
+ * enforce consistent spacing after the `#` in a comment
96
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/spaced-comment.html
97
+ */
98
+ 'toml/spaced-comment'?: Linter.RuleEntry<TomlSpacedComment>;
99
+ /**
100
+ * enforce consistent spacing inside table brackets
101
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/table-bracket-spacing.html
102
+ */
103
+ 'toml/table-bracket-spacing'?: Linter.RuleEntry<TomlTableBracketSpacing>;
104
+ /**
105
+ * disallow defining tables out-of-order
106
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/tables-order.html
107
+ */
108
+ 'toml/tables-order'?: Linter.RuleEntry<[]>;
109
+ /**
110
+ * disallow parsing errors in Vue custom blocks
111
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/vue-custom-block/no-parsing-error.html
112
+ */
113
+ 'toml/vue-custom-block/no-parsing-error'?: Linter.RuleEntry<[]>;
114
+ }
115
+ type TomlArrayBracketNewline = [] | [
116
+ (("always" | "never" | "consistent") | {
117
+ multiline?: boolean;
118
+ minItems?: (number | null);
119
+ })
120
+ ];
121
+ type TomlArrayBracketSpacing = [] | [("always" | "never")] | [
122
+ ("always" | "never"),
123
+ {
124
+ singleValue?: boolean;
125
+ objectsInArrays?: boolean;
126
+ arraysInArrays?: boolean;
127
+ }
128
+ ];
129
+ type TomlArrayElementNewline = [] | [
130
+ (_TomlArrayElementNewlineBasicConfig | {
131
+ ArrayExpression?: _TomlArrayElementNewlineBasicConfig;
132
+ ArrayPattern?: _TomlArrayElementNewlineBasicConfig;
133
+ TOMLArray?: _TomlArrayElementNewlineBasicConfig;
134
+ })
135
+ ];
136
+ type _TomlArrayElementNewlineBasicConfig = (("always" | "never" | "consistent") | {
137
+ multiline?: boolean;
138
+ minItems?: (number | null);
139
+ });
140
+ type TomlCommaStyle = [] | [("first" | "last")] | [
141
+ ("first" | "last"),
142
+ {
143
+ exceptions?: {
144
+ [k: string]: boolean | undefined;
145
+ };
146
+ }
147
+ ];
148
+ type TomlIndent = [] | [("tab" | number)] | [
149
+ ("tab" | number),
150
+ {
151
+ subTables?: number;
152
+ keyValuePairs?: number;
153
+ }
154
+ ];
155
+ type TomlInlineTableCurlySpacing = [] | [("always" | "never")] | [
156
+ ("always" | "never"),
157
+ {
158
+ arraysInObjects?: boolean;
159
+ objectsInObjects?: boolean;
160
+ }
161
+ ];
162
+ type TomlKeySpacing = [] | [
163
+ ({
164
+ align?: (("equal" | "value") | {
165
+ on?: ("equal" | "value");
166
+ mode?: ("strict" | "minimum");
167
+ beforeEqual?: boolean;
168
+ afterEqual?: boolean;
169
+ });
170
+ mode?: ("strict" | "minimum");
171
+ beforeEqual?: boolean;
172
+ afterEqual?: boolean;
173
+ } | {
174
+ singleLine?: {
175
+ mode?: ("strict" | "minimum");
176
+ beforeEqual?: boolean;
177
+ afterEqual?: boolean;
178
+ };
179
+ multiLine?: {
180
+ align?: (("equal" | "value") | {
181
+ on?: ("equal" | "value");
182
+ mode?: ("strict" | "minimum");
183
+ beforeEqual?: boolean;
184
+ afterEqual?: boolean;
185
+ });
186
+ mode?: ("strict" | "minimum");
187
+ beforeEqual?: boolean;
188
+ afterEqual?: boolean;
189
+ };
190
+ } | {
191
+ singleLine?: {
192
+ mode?: ("strict" | "minimum");
193
+ beforeEqual?: boolean;
194
+ afterEqual?: boolean;
195
+ };
196
+ multiLine?: {
197
+ mode?: ("strict" | "minimum");
198
+ beforeEqual?: boolean;
199
+ afterEqual?: boolean;
200
+ };
201
+ align?: {
202
+ on?: ("equal" | "value");
203
+ mode?: ("strict" | "minimum");
204
+ beforeEqual?: boolean;
205
+ afterEqual?: boolean;
206
+ };
207
+ })
208
+ ];
209
+ type TomlNoMixedTypeInArray = [] | [
210
+ {
211
+ typeMap?: {
212
+ string?: string;
213
+ boolean?: string;
214
+ integer?: string;
215
+ float?: string;
216
+ offsetDateTime?: string;
217
+ localDateTime?: string;
218
+ localDate?: string;
219
+ localTime?: string;
220
+ array?: string;
221
+ inlineTable?: string;
222
+ };
223
+ }
224
+ ];
225
+ type TomlNoNonDecimalInteger = [] | [
226
+ {
227
+ allowHexadecimal?: boolean;
228
+ allowOctal?: boolean;
229
+ allowBinary?: boolean;
230
+ }
231
+ ];
232
+ type TomlPrecisionOfFractionalSeconds = [] | [
233
+ {
234
+ max?: number;
235
+ }
236
+ ];
237
+ type TomlPrecisionOfInteger = [] | [
238
+ {
239
+ maxBit?: number;
240
+ }
241
+ ];
242
+ type TomlQuotedKeys = [] | [
243
+ {
244
+ prefer?: ("as-needed" | "always");
245
+ numbers?: boolean;
246
+ }
247
+ ];
248
+ type TomlSpacedComment = [] | [("always" | "never")] | [
249
+ ("always" | "never"),
250
+ {
251
+ exceptions?: string[];
252
+ markers?: string[];
253
+ }
254
+ ];
255
+ type TomlTableBracketSpacing = [] | [("always" | "never")];
256
+ export {};
@@ -0,0 +1,256 @@
1
+ import type { Linter } from 'eslint';
2
+ export interface TomlRules {
3
+ /**
4
+ * enforce linebreaks after opening and before closing array brackets
5
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/array-bracket-newline.html
6
+ */
7
+ 'toml/array-bracket-newline'?: Linter.RuleEntry<TomlArrayBracketNewline>;
8
+ /**
9
+ * enforce consistent spacing inside array brackets
10
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/array-bracket-spacing.html
11
+ */
12
+ 'toml/array-bracket-spacing'?: Linter.RuleEntry<TomlArrayBracketSpacing>;
13
+ /**
14
+ * enforce line breaks between array elements
15
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/array-element-newline.html
16
+ */
17
+ 'toml/array-element-newline'?: Linter.RuleEntry<TomlArrayElementNewline>;
18
+ /**
19
+ * enforce consistent comma style in array
20
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/comma-style.html
21
+ */
22
+ 'toml/comma-style'?: Linter.RuleEntry<TomlCommaStyle>;
23
+ /**
24
+ * enforce consistent indentation
25
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/indent.html
26
+ */
27
+ 'toml/indent'?: Linter.RuleEntry<TomlIndent>;
28
+ /**
29
+ * enforce consistent spacing inside braces
30
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/inline-table-curly-spacing.html
31
+ */
32
+ 'toml/inline-table-curly-spacing'?: Linter.RuleEntry<TomlInlineTableCurlySpacing>;
33
+ /**
34
+ * enforce consistent spacing between keys and values in key/value pairs
35
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/key-spacing.html
36
+ */
37
+ 'toml/key-spacing'?: Linter.RuleEntry<TomlKeySpacing>;
38
+ /**
39
+ * disallow defining pair keys out-of-order
40
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/keys-order.html
41
+ */
42
+ 'toml/keys-order'?: Linter.RuleEntry<[]>;
43
+ /**
44
+ * disallow mixed data types in array
45
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/no-mixed-type-in-array.html
46
+ */
47
+ 'toml/no-mixed-type-in-array'?: Linter.RuleEntry<TomlNoMixedTypeInArray>;
48
+ /**
49
+ * disallow hexadecimal, octal and binary integer
50
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/no-non-decimal-integer.html
51
+ */
52
+ 'toml/no-non-decimal-integer'?: Linter.RuleEntry<TomlNoNonDecimalInteger>;
53
+ /**
54
+ * disallow spacing around infix operators
55
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/no-space-dots.html
56
+ */
57
+ 'toml/no-space-dots'?: Linter.RuleEntry<[]>;
58
+ /**
59
+ * disallow number separators that to not enhance readability.
60
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/no-unreadable-number-separator.html
61
+ */
62
+ 'toml/no-unreadable-number-separator'?: Linter.RuleEntry<[]>;
63
+ /**
64
+ * require or disallow padding lines between pairs
65
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/padding-line-between-pairs.html
66
+ */
67
+ 'toml/padding-line-between-pairs'?: Linter.RuleEntry<[]>;
68
+ /**
69
+ * require or disallow padding lines between tables
70
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/padding-line-between-tables.html
71
+ */
72
+ 'toml/padding-line-between-tables'?: Linter.RuleEntry<[]>;
73
+ /**
74
+ * disallow precision of fractional seconds greater than the specified value.
75
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/precision-of-fractional-seconds.html
76
+ */
77
+ 'toml/precision-of-fractional-seconds'?: Linter.RuleEntry<TomlPrecisionOfFractionalSeconds>;
78
+ /**
79
+ * disallow precision of integer greater than the specified value.
80
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/precision-of-integer.html
81
+ */
82
+ 'toml/precision-of-integer'?: Linter.RuleEntry<TomlPrecisionOfInteger>;
83
+ /**
84
+ * require or disallow quotes around keys
85
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/quoted-keys.html
86
+ */
87
+ 'toml/quoted-keys'?: Linter.RuleEntry<TomlQuotedKeys>;
88
+ /**
89
+ * require spacing around equals sign
90
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/space-eq-sign.html
91
+ * @deprecated
92
+ */
93
+ 'toml/space-eq-sign'?: Linter.RuleEntry<[]>;
94
+ /**
95
+ * enforce consistent spacing after the `#` in a comment
96
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/spaced-comment.html
97
+ */
98
+ 'toml/spaced-comment'?: Linter.RuleEntry<TomlSpacedComment>;
99
+ /**
100
+ * enforce consistent spacing inside table brackets
101
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/table-bracket-spacing.html
102
+ */
103
+ 'toml/table-bracket-spacing'?: Linter.RuleEntry<TomlTableBracketSpacing>;
104
+ /**
105
+ * disallow defining tables out-of-order
106
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/tables-order.html
107
+ */
108
+ 'toml/tables-order'?: Linter.RuleEntry<[]>;
109
+ /**
110
+ * disallow parsing errors in Vue custom blocks
111
+ * @see https://ota-meshi.github.io/eslint-plugin-toml/rules/vue-custom-block/no-parsing-error.html
112
+ */
113
+ 'toml/vue-custom-block/no-parsing-error'?: Linter.RuleEntry<[]>;
114
+ }
115
+ type TomlArrayBracketNewline = [] | [
116
+ (("always" | "never" | "consistent") | {
117
+ multiline?: boolean;
118
+ minItems?: (number | null);
119
+ })
120
+ ];
121
+ type TomlArrayBracketSpacing = [] | [("always" | "never")] | [
122
+ ("always" | "never"),
123
+ {
124
+ singleValue?: boolean;
125
+ objectsInArrays?: boolean;
126
+ arraysInArrays?: boolean;
127
+ }
128
+ ];
129
+ type TomlArrayElementNewline = [] | [
130
+ (_TomlArrayElementNewlineBasicConfig | {
131
+ ArrayExpression?: _TomlArrayElementNewlineBasicConfig;
132
+ ArrayPattern?: _TomlArrayElementNewlineBasicConfig;
133
+ TOMLArray?: _TomlArrayElementNewlineBasicConfig;
134
+ })
135
+ ];
136
+ type _TomlArrayElementNewlineBasicConfig = (("always" | "never" | "consistent") | {
137
+ multiline?: boolean;
138
+ minItems?: (number | null);
139
+ });
140
+ type TomlCommaStyle = [] | [("first" | "last")] | [
141
+ ("first" | "last"),
142
+ {
143
+ exceptions?: {
144
+ [k: string]: boolean | undefined;
145
+ };
146
+ }
147
+ ];
148
+ type TomlIndent = [] | [("tab" | number)] | [
149
+ ("tab" | number),
150
+ {
151
+ subTables?: number;
152
+ keyValuePairs?: number;
153
+ }
154
+ ];
155
+ type TomlInlineTableCurlySpacing = [] | [("always" | "never")] | [
156
+ ("always" | "never"),
157
+ {
158
+ arraysInObjects?: boolean;
159
+ objectsInObjects?: boolean;
160
+ }
161
+ ];
162
+ type TomlKeySpacing = [] | [
163
+ ({
164
+ align?: (("equal" | "value") | {
165
+ on?: ("equal" | "value");
166
+ mode?: ("strict" | "minimum");
167
+ beforeEqual?: boolean;
168
+ afterEqual?: boolean;
169
+ });
170
+ mode?: ("strict" | "minimum");
171
+ beforeEqual?: boolean;
172
+ afterEqual?: boolean;
173
+ } | {
174
+ singleLine?: {
175
+ mode?: ("strict" | "minimum");
176
+ beforeEqual?: boolean;
177
+ afterEqual?: boolean;
178
+ };
179
+ multiLine?: {
180
+ align?: (("equal" | "value") | {
181
+ on?: ("equal" | "value");
182
+ mode?: ("strict" | "minimum");
183
+ beforeEqual?: boolean;
184
+ afterEqual?: boolean;
185
+ });
186
+ mode?: ("strict" | "minimum");
187
+ beforeEqual?: boolean;
188
+ afterEqual?: boolean;
189
+ };
190
+ } | {
191
+ singleLine?: {
192
+ mode?: ("strict" | "minimum");
193
+ beforeEqual?: boolean;
194
+ afterEqual?: boolean;
195
+ };
196
+ multiLine?: {
197
+ mode?: ("strict" | "minimum");
198
+ beforeEqual?: boolean;
199
+ afterEqual?: boolean;
200
+ };
201
+ align?: {
202
+ on?: ("equal" | "value");
203
+ mode?: ("strict" | "minimum");
204
+ beforeEqual?: boolean;
205
+ afterEqual?: boolean;
206
+ };
207
+ })
208
+ ];
209
+ type TomlNoMixedTypeInArray = [] | [
210
+ {
211
+ typeMap?: {
212
+ string?: string;
213
+ boolean?: string;
214
+ integer?: string;
215
+ float?: string;
216
+ offsetDateTime?: string;
217
+ localDateTime?: string;
218
+ localDate?: string;
219
+ localTime?: string;
220
+ array?: string;
221
+ inlineTable?: string;
222
+ };
223
+ }
224
+ ];
225
+ type TomlNoNonDecimalInteger = [] | [
226
+ {
227
+ allowHexadecimal?: boolean;
228
+ allowOctal?: boolean;
229
+ allowBinary?: boolean;
230
+ }
231
+ ];
232
+ type TomlPrecisionOfFractionalSeconds = [] | [
233
+ {
234
+ max?: number;
235
+ }
236
+ ];
237
+ type TomlPrecisionOfInteger = [] | [
238
+ {
239
+ maxBit?: number;
240
+ }
241
+ ];
242
+ type TomlQuotedKeys = [] | [
243
+ {
244
+ prefer?: ("as-needed" | "always");
245
+ numbers?: boolean;
246
+ }
247
+ ];
248
+ type TomlSpacedComment = [] | [("always" | "never")] | [
249
+ ("always" | "never"),
250
+ {
251
+ exceptions?: string[];
252
+ markers?: string[];
253
+ }
254
+ ];
255
+ type TomlTableBracketSpacing = [] | [("always" | "never")];
256
+ export {};
@@ -11,4 +11,5 @@ export * from './gens/regexp';
11
11
  export * from './gens/typescript';
12
12
  export * from './gens/vue';
13
13
  export * from './gens/yml';
14
+ export * from './gens/toml';
14
15
  export * from './gens/eslint';
@@ -11,4 +11,5 @@ export * from './gens/regexp';
11
11
  export * from './gens/typescript';
12
12
  export * from './gens/vue';
13
13
  export * from './gens/yml';
14
+ export * from './gens/toml';
14
15
  export * from './gens/eslint';
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@kazupon/eslint-config",
3
- "version": "0.9.0",
4
3
  "description": "ESLint config for @kazupon",
5
- "keywords": [
6
- "config",
7
- "eslint"
8
- ],
4
+ "version": "0.10.0",
5
+ "author": {
6
+ "email": "kawakazu80@gmail.com",
7
+ "name": "kazuya kawaguchi"
8
+ },
9
9
  "license": "MIT",
10
10
  "funding": "https://github.com/sponsors/kazupon",
11
11
  "bugs": {
@@ -15,6 +15,10 @@
15
15
  "type": "git",
16
16
  "url": "git+https://github.com/kazupon/eslint-config.git"
17
17
  },
18
+ "keywords": [
19
+ "config",
20
+ "eslint"
21
+ ],
18
22
  "homepage": "https://github.com/kazupon/eslint-config#readme",
19
23
  "publishConfig": {
20
24
  "access": "public"
@@ -25,7 +29,6 @@
25
29
  "type": "module",
26
30
  "main": "./dist/index.cjs",
27
31
  "module": "./dist/index.js",
28
- "types": "./dist/index.d.ts",
29
32
  "files": [
30
33
  "dist"
31
34
  ],
@@ -35,6 +38,7 @@
35
38
  "require": "./dist/index.cjs"
36
39
  }
37
40
  },
41
+ "types": "./dist/index.d.ts",
38
42
  "dependencies": {
39
43
  "@eslint-community/eslint-plugin-eslint-comments": "^4.3.0",
40
44
  "@eslint/js": "^9.0.0",
@@ -48,6 +52,7 @@
48
52
  "eslint-plugin-jsonc": ">=2.16.0",
49
53
  "eslint-plugin-promise": ">=6.4.0",
50
54
  "eslint-plugin-regexp": ">=2.6.0",
55
+ "eslint-plugin-toml": ">=0.11.0",
51
56
  "eslint-plugin-unicorn": ">=54.0.0",
52
57
  "eslint-plugin-vue": ">=9.24.0",
53
58
  "eslint-plugin-yml": ">=1.14.0",
@@ -69,6 +74,9 @@
69
74
  "eslint-plugin-regexp": {
70
75
  "optional": true
71
76
  },
77
+ "eslint-plugin-toml": {
78
+ "optional": true
79
+ },
72
80
  "eslint-plugin-unicorn": {
73
81
  "optional": true
74
82
  },
@@ -93,6 +101,7 @@
93
101
  "eslint-plugin-jsonc": "^2.16.0",
94
102
  "eslint-plugin-promise": "^6.4.0",
95
103
  "eslint-plugin-regexp": "^2.6.0",
104
+ "eslint-plugin-toml": "^0.11.0",
96
105
  "eslint-plugin-unicorn": "^54.0.0",
97
106
  "eslint-plugin-vue": "^9.27.0",
98
107
  "eslint-plugin-yml": "^1.14.0",
@@ -107,34 +116,34 @@
107
116
  "typescript-eslint": "^7.15.0",
108
117
  "vitest": "^2.0.0"
109
118
  },
119
+ "prettier": "@kazupon/prettier-config",
110
120
  "lint-staged": {
111
- "*.{json,jsonc,json5,md,yml,yaml}": [
112
- "prettier --write"
121
+ "*.ts?(x)": [
122
+ "prettier --parser=typescript --write",
123
+ "eslint --fix"
113
124
  ],
114
125
  "*.{js,mjs,cjs}": [
115
126
  "prettier --write",
116
127
  "eslint --fix"
117
128
  ],
118
- "*.ts?(x)": [
119
- "prettier --parser=typescript --write",
120
- "eslint --fix"
129
+ "*.{json,jsonc,json5,md,yml,yaml}": [
130
+ "prettier --write"
121
131
  ]
122
132
  },
123
- "prettier": "@kazupon/prettier-config",
124
133
  "scripts": {
134
+ "build": "tsdown",
135
+ "build:inspector": "pnpm build && pnpx @eslint/config-inspector build",
125
136
  "changelog": "gh-changelogen --repo=kazupon/eslint-config",
126
- "release": "bumpp --commit \"release: v%s\" --all --push --tag",
127
- "lint": "run-p \"lint:* {@}\" --",
128
- "lint:prettier": "prettier . --check",
129
- "lint:eslint": "eslint .",
137
+ "dev": "pnpx @eslint/config-inspector --config eslint.config.ts",
130
138
  "fix": "run-p \"fix:* {@}\" --",
131
- "fix:prettier": "prettier . --write",
132
139
  "fix:eslint": "eslint . --fix",
133
- "dev": "pnpx @eslint/config-inspector --config eslint.config.ts",
140
+ "fix:prettier": "prettier . --write",
141
+ "lint": "run-p \"lint:* {@}\" --",
142
+ "lint:eslint": "eslint .",
143
+ "lint:prettier": "prettier . --check",
144
+ "release": "bumpp --commit \"release: v%s\" --all --push --tag",
134
145
  "test": "vitest",
135
- "typegen": "pnpx tsx scripts/typegen.ts",
136
- "build": "tsdown",
137
- "build:inspector": "pnpm build && pnpx @eslint/config-inspector build",
138
- "typecheck": "tsc -p ."
146
+ "typecheck": "tsc -p .",
147
+ "typegen": "pnpx tsx scripts/typegen.ts"
139
148
  }
140
149
  }