You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4059169
Browse filesBrowse the repository at this point in the historyBrowse files
Drop legacy ESLint config support - export flat config as main format (#527)
* Initial plan
* Drop support for legacy config - make flat config the main export
Co-authored-by: ota-meshi <16508807+ota-meshi@users.noreply.github.com>
* Add changeset and update auto-generated config files
Co-authored-by: ota-meshi <16508807+ota-meshi@users.noreply.github.com>
* Update drop-legacy-config-support.md
* Revert accidental change to docs/rules/index.md
Co-authored-by: ota-meshi <16508807+ota-meshi@users.noreply.github.com>
* update
* Update rule documentation to use new config format
Co-authored-by: ota-meshi <16508807+ota-meshi@users.noreply.github.com>
* format
* Fix docs/rules/index.md to use new config format
Co-authored-by: ota-meshi <16508807+ota-meshi@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ota-meshi <16508807+ota-meshi@users.noreply.github.com>
Co-authored-by: Yosuke Ota <otameshiyo23@gmail.com>
Drop support for legacy ESLint config format. The plugin now exports flat configuration as the main configuration format. The previous `flat/*` namespace is kept for backward compatibility.
Use `eslint.config.js` file to configure rules. See also: <https://eslint.org/docs/latest/use/configure/configuration-files-new>.
71
69
72
70
Example **eslint.config.js**:
@@ -76,7 +74,7 @@ import eslintPluginYml from 'eslint-plugin-yml';
76
74
exportdefault [
77
75
// add more generic rule sets here, such as:
78
76
// js.configs.recommended,
79
-
...eslintPluginYml.configs['flat/recommended'],
77
+
...eslintPluginYml.configs.recommended,
80
78
{
81
79
rules: {
82
80
// override/add rules settings here, such as:
@@ -88,41 +86,14 @@ export default [
88
86
89
87
This plugin provides configs:
90
88
91
-
-`*.configs['flat/base']` ... Configuration to enable correct YAML parsing.
92
-
-`*.configs['flat/recommended']` ... Above, plus rules to prevent errors or unintended behavior.
93
-
-`*.configs['flat/standard']` ... Above, plus rules to enforce the common stylistic conventions.
94
-
-`*.configs['flat/prettier']` ... Turn off rules that may conflict with [Prettier](https://prettier.io/).
89
+
-`*.configs.base` ... Configuration to enable correct YAML parsing.
90
+
-`*.configs.recommended` ... Above, plus rules to prevent errors or unintended behavior.
91
+
-`*.configs.standard` ... Above, plus rules to enforce the common stylistic conventions.
92
+
-`*.configs.prettier` ... Turn off rules that may conflict with [Prettier](https://prettier.io/).
95
93
96
94
See [the rule list](https://ota-meshi.github.io/eslint-plugin-yml/rules/) to get the `rules` that this plugin provides.
97
95
98
-
#### Legacy Config (`.eslintrc`)
99
-
100
-
Use `.eslintrc.*` file to configure rules. See also: <https://eslint.org/docs/latest/use/configure/>.
101
-
102
-
Example **.eslintrc.js**:
103
-
104
-
```js
105
-
module.exports= {
106
-
extends: [
107
-
// add more generic rulesets here, such as:
108
-
// 'eslint:recommended',
109
-
"plugin:yml/standard",
110
-
],
111
-
rules: {
112
-
// override/add rules settings here, such as:
113
-
// 'yml/rule-name': 'error'
114
-
},
115
-
};
116
-
```
117
-
118
-
This plugin provides configs:
119
-
120
-
-`plugin:yml/base` ... Configuration to enable correct YAML parsing.
121
-
-`plugin:yml/recommended` ... Above, plus rules to prevent errors or unintended behavior.
122
-
-`plugin:yml/standard` ... Above, plus rules to enforce the common stylistic conventions.
123
-
-`plugin:yml/prettier` ... Turn off rules that may conflict with [Prettier](https://prettier.io/).
124
-
125
-
See [the rule list](https://ota-meshi.github.io/eslint-plugin-yml/rules/) to get the `rules` that this plugin provides.
96
+
**Note:** The `*.configs['flat/*']` configs are still available for backward compatibility, but it is recommended to use the new config names without the `flat/` prefix.
126
97
127
98
#### Parser Configuration
128
99
@@ -131,53 +102,51 @@ If you have specified a parser, you need to configure a parser for `.yaml`.
131
102
For example, if you are using the `"@babel/eslint-parser"`, configure it as follows:
132
103
133
104
```js
134
-
module.exports= {
135
-
// ...
136
-
extends: ["plugin:yml/standard"],
137
-
// ...
138
-
parser:"@babel/eslint-parser",
139
-
// Add an `overrides` section to add a parser configuration for YAML.
140
-
overrides: [
141
-
{
142
-
files: ["*.yaml", "*.yml"],
143
-
parser:"yaml-eslint-parser",
105
+
importeslintPluginYmlfrom'eslint-plugin-yml';
106
+
importbabelParserfrom'@babel/eslint-parser';
107
+
108
+
exportdefault [
109
+
...eslintPluginYml.configs.standard,
110
+
{
111
+
files: ['**/*.js'],
112
+
languageOptions: {
113
+
parser: babelParser,
144
114
},
145
-
],
146
-
//...
147
-
};
115
+
},
116
+
//YAML files are already configured by the plugin
117
+
];
148
118
```
149
119
150
120
#### Parser Options
151
121
152
122
The following parser options for `yaml-eslint-parser` are available by specifying them in [parserOptions](https://eslint.org/docs/latest/user-guide/configuring/language-options#specifying-parser-options) in the ESLint configuration file.
153
123
154
124
```js
155
-
module.exports= {
156
-
// ...
157
-
overrides: [
158
-
{
159
-
files: ["*.yaml", "*.yml"],
160
-
parser:"yaml-eslint-parser",
161
-
// Options used with yaml-eslint-parser.
125
+
importeslintPluginYmlfrom'eslint-plugin-yml';
126
+
127
+
exportdefault [
128
+
...eslintPluginYml.configs.recommended,
129
+
{
130
+
files: ['**/*.yaml', '**/*.yml'],
131
+
languageOptions: {
162
132
parserOptions: {
163
-
defaultYAMLVersion:"1.2",
133
+
defaultYAMLVersion:'1.2',
164
134
},
165
135
},
166
-
],
167
-
// ...
168
-
};
136
+
},
137
+
];
169
138
```
170
139
171
140
See also [https://github.com/ota-meshi/yaml-eslint-parser#readme](https://github.com/ota-meshi/yaml-eslint-parser#readme).
172
141
173
142
### Running ESLint from the command line
174
143
175
-
If you want to run `eslint` from the command line, make sure you include the `.yaml` extension using [the `--ext` option](https://eslint.org/docs/user-guide/configuring#specifying-file-extensions-to-lint) or a glob pattern, because ESLint targets only `.js` files by default.
144
+
With ESLint v9 and flat config, ESLint automatically lints all files matched by your config. You typically don't need the `--ext` option anymore.
Copy file name to clipboardExpand all lines: docs/rules/block-mapping-colon-indicator-newline.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ since: "v1.2.0"
10
10
11
11
> enforce consistent line breaks after `:` indicator
12
12
13
-
-:gear: This rule is included in `"plugin:yml/standard"`.
13
+
-:gear: This rule is included in `configs.standard`.
14
14
-:wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
Copy file name to clipboardExpand all lines: docs/rules/block-mapping-question-indicator-newline.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ since: "v0.5.0"
10
10
11
11
> enforce consistent line breaks after `?` indicator
12
12
13
-
-:gear: This rule is included in `"plugin:yml/standard"`.
13
+
-:gear: This rule is included in `configs.standard`.
14
14
-:wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
Copy file name to clipboardExpand all lines: docs/rules/block-mapping.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ since: "v0.1.0"
10
10
11
11
> require or disallow block style mappings.
12
12
13
-
-:gear: This rule is included in `"plugin:yml/standard"`.
13
+
-:gear: This rule is included in `configs.standard`.
14
14
-:wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
Copy file name to clipboardExpand all lines: docs/rules/block-sequence-hyphen-indicator-newline.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ since: "v0.5.0"
10
10
11
11
> enforce consistent line breaks after `-` indicator
12
12
13
-
-:gear: This rule is included in `"plugin:yml/standard"`.
13
+
-:gear: This rule is included in `configs.standard`.
14
14
-:wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
Copy file name to clipboardExpand all lines: docs/rules/block-sequence.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ since: "v0.1.0"
10
10
11
11
> require or disallow block style sequences.
12
12
13
-
-:gear: This rule is included in `"plugin:yml/standard"`.
13
+
-:gear: This rule is included in `configs.standard`.
14
14
-:wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
Copy file name to clipboardExpand all lines: docs/rules/flow-mapping-curly-newline.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ since: "v0.1.0"
10
10
11
11
> enforce consistent line breaks inside braces
12
12
13
-
-:gear: This rule is included in `"plugin:yml/standard"`.
13
+
-:gear: This rule is included in `configs.standard`.
14
14
-:wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
Copy file name to clipboardExpand all lines: docs/rules/flow-mapping-curly-spacing.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ since: "v0.1.0"
10
10
11
11
> enforce consistent spacing inside braces
12
12
13
-
-:gear: This rule is included in `"plugin:yml/standard"`.
13
+
-:gear: This rule is included in `configs.standard`.
14
14
-:wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
Copy file name to clipboardExpand all lines: docs/rules/flow-sequence-bracket-newline.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ since: "v0.1.0"
10
10
11
11
> enforce linebreaks after opening and before closing flow sequence brackets
12
12
13
-
-:gear: This rule is included in `"plugin:yml/standard"`.
13
+
-:gear: This rule is included in `configs.standard`.
14
14
-:wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
0 commit comments