-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: support ESLint's flat config * docs(readme): add new `configType` option to readme * ci: remove eslint 7x * test: skip test on node versions lt 20 --------- Co-authored-by: Ricardo Gobbo de Souza <[email protected]>
- Loading branch information
1 parent
445389c
commit 19cadbe
Showing
9 changed files
with
134 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
module.exports = [ | ||
{ | ||
files: ["*.js"], | ||
rules: {} | ||
} | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { join } from 'path'; | ||
|
||
import pack from './utils/pack'; | ||
|
||
describe('succeed on flat-configuration', () => { | ||
it('cannot load FlatESLint class on default ESLint module', (done) => { | ||
const overrideConfigFile = join(__dirname, 'fixtures', 'flat-config.js'); | ||
const compiler = pack('full-of-problems', { | ||
configType: 'flat', | ||
overrideConfigFile, | ||
threads: 1, | ||
}); | ||
|
||
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( | ||
/Couldn't find FlatESLint, you might need to set eslintPath to 'eslint\/use-at-your-own-risk'/i, | ||
); | ||
done(); | ||
}); | ||
}); | ||
|
||
(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; | ||
|
||
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(); | ||
}); | ||
}); | ||
}); |