Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ const TYPESCRIPT_EXTENSION = [
const DEFAULT_EXTENSION = [
'js',
'jsx',
'mjs',
'cjs',
...TYPESCRIPT_EXTENSION
];

Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ Use one or more [shareable configs](https://eslint.org/docs/developer-guide/shar

Type: `string[]`

Allow more extensions to be linted besides `.js` and `.jsx`. Make sure they're supported by ESLint or an ESLint plugin.
Allow more extensions to be linted besides `.js`, `.jsx`, `.mjs`, and `.cjs`. Make sure they're supported by ESLint or an ESLint plugin.

### settings

Expand Down
4 changes: 2 additions & 2 deletions test/cli-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ test('space option with boolean strings', async t => {

test('extension option', async t => {
const cwd = path.join(__dirname, 'fixtures/custom-extension');
const {stdout} = await t.throwsAsync(main(['--reporter=json', '--extension=mjs'], {cwd}));
const {stdout} = await t.throwsAsync(main(['--reporter=json', '--extension=unknown'], {cwd}));
const reports = JSON.parse(stdout);

t.is(reports.length, 1);
t.true(reports[0].filePath.endsWith('.mjs'));
t.true(reports[0].filePath.endsWith('.unknown'));
});