Skip to content

Commit

Permalink
support cjs config file extension for eslint (#19)
Browse files Browse the repository at this point in the history
* support cjs config file extension for eslint

* Update src/parsers/DocumentParser.js

Co-authored-by: Gabriel McAdams <ghmcadams@users.noreply.github.com>
  • Loading branch information
xiaoxiangmoe and ghmcadams committed Mar 15, 2020
1 parent 1d209ca commit 3b93f56
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -20,7 +20,7 @@ Adds details and a documentation link beside each [ESLint rule](https://eslint.o

Supports all configuration file formats currently [supported by ESLint](https://eslint.org/docs/user-guide/configuring#configuration-file-formats)

- JavaScript - use `.eslintrc.js` and export an object containing your configuration.
- JavaScript - use `.eslintrc.js` or `.eslintrc.cjs` and export an object containing your configuration.
- YAML - use `.eslintrc.yaml` or `.eslintrc.yml` to define the configuration structure.
- JSON - use `.eslintrc.json` to define the configuration structure. ESLint’s JSON files also allow JavaScript-style comments.
- **Deprecated** - use `.eslintrc`, which can be either JSON or YAML.
Expand Down
2 changes: 1 addition & 1 deletion src/parsers/DocumentParser.js
Expand Up @@ -23,7 +23,7 @@ export default class DocumentParser extends Parser {

if (new.target === DocumentParser) {
// Choose parser based on filename and language
if (isMatch('javascript', '**/.eslintrc.js') || isMatch('javascriptreact', '**/.eslintrc.js')) {
if (isMatch('javascript', '**/.eslintrc.js', '**/.eslintrc.cjs') || isMatch('javascriptreact', '**/.eslintrc.js', '**/.eslintrc.cjs')) {
return new JSParser(document);
} else if (isMatch('json', '**/.eslintrc', '**/.eslintrc.json') || isMatch('jsonc', '**/.eslintrc', '**/.eslintrc.json')) {
return new JSONParser(document);
Expand Down

0 comments on commit 3b93f56

Please sign in to comment.