Skip to content

Commit ee0007e

Browse files
feat!: use flat config by default
1 parent d6664e5 commit ee0007e

File tree

6 files changed

+35
-14
lines changed

6 files changed

+35
-14
lines changed

Diff for: README.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Specify the path to the cache location. Can be a file or a directory.
114114
type configType = 'flat' | 'eslintrc';
115115
```
116116

117-
- Default: `eslintrc`
117+
- Default: `flat`
118118

119119
Specify the type of configuration to use with ESLint.
120120

@@ -123,9 +123,6 @@ Specify the type of configuration to use with ESLint.
123123

124124
The new configuration format is explained in its [own documentation](https://eslint.org/docs/latest/use/configure/configuration-files-new).
125125

126-
> This configuration format being considered as experimental, it is not exported in the main ESLint module in ESLint 8.
127-
> You need to set your `eslintPath` to `eslint/use-at-your-own-risk` for this config format to work.
128-
129126
### `context`
130127

131128
- Type:

Diff for: src/options.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ const schema = require('./options.json');
44

55
/** @typedef {import("eslint").ESLint.Options} ESLintOptions */
66
/** @typedef {import('eslint').ESLint.LintResult} LintResult */
7-
/** @typedef {import('eslint').ESLint.LintResultData} LintResultData */
87

98
/**
109
* @callback FormatterFunction
1110
* @param {LintResult[]} results
12-
* @param {LintResultData=} data
1311
* @returns {string}
1412
*/
1513

@@ -50,6 +48,7 @@ function getOptions(pluginOptions) {
5048
const options = {
5149
cache: true,
5250
cacheLocation: 'node_modules/.cache/eslint-webpack-plugin/.eslintcache',
51+
configType: 'flat',
5352
extensions: 'js',
5453
emitError: true,
5554
emitWarning: true,

Diff for: src/options.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"additionalProperties": true,
44
"properties": {
55
"configType": {
6-
"description": "Enable flat config by setting this value to `flat`.",
6+
"description": "Specify the type of configuration to use with ESLint, `flat` or `eslintrc`.",
77
"type": "string"
88
},
99
"context": {

Diff for: test/empty.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe('empty', () => {
1010
context: join(__dirname, 'fixtures', 'empty'),
1111
mode: 'development',
1212
entry: '../',
13-
plugins: [new ESLintPlugin()],
13+
plugins: [new ESLintPlugin({ configType: 'eslintrc' })],
1414
});
1515

1616
compiler.run((err, stats) => {

Diff for: test/multiple-instances.test.js

+30-6
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,16 @@ describe('multiple instances', () => {
99
{},
1010
{
1111
plugins: [
12-
new ESLintPlugin({ ignore: false, exclude: 'error.js' }),
13-
new ESLintPlugin({ ignore: false, exclude: 'error.js' }),
12+
new ESLintPlugin({
13+
configType: 'eslintrc',
14+
ignore: false,
15+
exclude: 'error.js',
16+
}),
17+
new ESLintPlugin({
18+
configType: 'eslintrc',
19+
ignore: false,
20+
exclude: 'error.js',
21+
}),
1422
],
1523
},
1624
);
@@ -26,8 +34,16 @@ describe('multiple instances', () => {
2634
{},
2735
{
2836
plugins: [
29-
new ESLintPlugin({ ignore: false, exclude: 'good.js' }),
30-
new ESLintPlugin({ ignore: false, exclude: 'error.js' }),
37+
new ESLintPlugin({
38+
configType: 'eslintrc',
39+
ignore: false,
40+
exclude: 'good.js',
41+
}),
42+
new ESLintPlugin({
43+
configType: 'eslintrc',
44+
ignore: false,
45+
exclude: 'error.js',
46+
}),
3147
],
3248
},
3349
);
@@ -43,8 +59,16 @@ describe('multiple instances', () => {
4359
{},
4460
{
4561
plugins: [
46-
new ESLintPlugin({ ignore: false, exclude: 'error.js' }),
47-
new ESLintPlugin({ ignore: false, exclude: 'good.js' }),
62+
new ESLintPlugin({
63+
configType: 'eslintrc',
64+
ignore: false,
65+
exclude: 'error.js',
66+
}),
67+
new ESLintPlugin({
68+
configType: 'eslintrc',
69+
ignore: false,
70+
exclude: 'good.js',
71+
}),
4872
],
4973
},
5074
);

Diff for: test/utils/conf.js

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export default (entry, pluginConf = {}, webpackConf = {}) => {
1414
},
1515
plugins: [
1616
new ESLintPlugin({
17+
configType: 'eslintrc',
1718
// this disables the use of .eslintignore, since it contains the fixtures
1819
// folder to skip it on the global linting, but here we want the opposite
1920
// (we only use .eslintignore on the test that checks this)

0 commit comments

Comments
 (0)