Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support cjs config file extension for eslint #19

Merged
merged 3 commits into from Mar 15, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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