Skip to content

Commit

Permalink
chore: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardogobbosouza committed Jan 2, 2024
1 parent a8c8761 commit c6378fd
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 24 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,13 @@ Specify the path to the cache location. Can be a file or a directory.
- Type:

```ts
type configType = "flat" | "eslintrc";
type configType = 'flat' | 'eslintrc';
```

- Default: `eslintrc`

Specify the type of configuration to use with ESLint.

- `eslintrc` is the classic configuration format available in most ESLint versions.
- `flat` is the new format introduced in ESLint 8.21.0.

Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class ESLintWebpackPlugin {
// @ts-ignore
// eslint-disable-next-line no-underscore-dangle
module._source
).source()
).source(),
);
const file = { path: filePath, content };
files.push(file);
Expand Down
2 changes: 1 addition & 1 deletion src/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async function lintFiles(files) {
if (result) {
results.push(...result);
}
})
}),
);

// istanbul ignore else
Expand Down
43 changes: 22 additions & 21 deletions test/flat-config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,28 @@ describe('succeed on flat-configuration', () => {
});
});

(process.version.match(/^v(\d+\.\d+)/)[1] >= 20 ? it : it.skip)('finds errors on files', (done) => {
const overrideConfigFile = join(__dirname, 'fixtures', 'flat-config.js');
const compiler = pack('full-of-problems', {
configType: 'flat',
// needed for now
eslintPath: 'eslint/use-at-your-own-risk',
overrideConfigFile,
threads: 1,
});
(process.version.match(/^v(\d+\.\d+)/)[1] >= 20 ? it : it.skip)(
'finds errors on files',
(done) => {
const overrideConfigFile = join(__dirname, 'fixtures', 'flat-config.js');
const compiler = pack('full-of-problems', {
configType: 'flat',
// needed for now
eslintPath: 'eslint/use-at-your-own-risk',
overrideConfigFile,
threads: 1,
});

compiler.run((err, stats) => {
expect(err).toBeNull();
const { errors } = stats.compilation;
compiler.run((err, stats) => {
expect(err).toBeNull();
const { errors } = stats.compilation;

expect(stats.hasErrors()).toBe(true);
expect(errors).toHaveLength(1);
expect(errors[0].message).toMatch(
/full-of-problems\.js/i,
);
expect(stats.hasWarnings()).toBe(true);
done();
});
});
expect(stats.hasErrors()).toBe(true);
expect(errors).toHaveLength(1);
expect(errors[0].message).toMatch(/full-of-problems\.js/i);
expect(stats.hasWarnings()).toBe(true);
done();
});
},
);
});

0 comments on commit c6378fd

Please sign in to comment.