digitalbazaar / eslint-config-digitalbazaar

BSD 3-Clause "New" or "Revised" License
2 stars 1 forks source link

Add override to hand *.cjs and *.mjs files. #54

Closed davidlehn closed 2 years ago

davidlehn commented 2 years ago

I'm not entirely sure this is the correct way to do this but it seemed to work in my limited test. Was surprised it wasn't happening by default since node uses this extensions now.

mattcollier commented 2 years ago

@davidlehn in what context are you finding this necessary? I added a foo.cjs file and a bar.mjs file to bedrock-ledger-core and eslint is linting them properly.

davidlehn commented 2 years ago

@mattcollier Hmm. Perhaps some local config is breaking it for me. As part of the ESM fixes in many repos, I was moving index.js to index.cjs, .eslintrc.js to .eslintrc.cjs, and karma.conf.js to karma.conf.cjs, and they were not getting linted. Running the local eslint with debug output and it showed it ignoring cjs files, so I added this patch. I'll look into why it's a problem here.

aljones15 commented 2 years ago

@mattcollier Hmm. Perhaps some local config is breaking it for me. As part of the ESM fixes in many repos, I was moving index.js to index.cjs, .eslintrc.js to .eslintrc.cjs, and karma.conf.js to karma.conf.cjs, and they were not getting linted. Running the local eslint with debug output and it showed it ignoring cjs files, so I added this patch. I'll look into why it's a problem here.

it might be the editor. ALE in vim might not have the same super sensitive settings as say VS Code which can lint just about anything.

davidlehn commented 2 years ago

@aljones15 Running our npm lint target or just plain eslint on command line is the failure I was addressing.

aljones15 commented 2 years ago

@aljones15 Running our npm lint target or just plain eslint on command line is the failure I was addressing.

Ok that makes sense. When you open the file in an editor the linter should run on the file (including vue), but if the lint command in a project does not specify *.cjs or *.mjs then yeah it could fail. good point.

aljones15 commented 2 years ago

p.s. has this been tested in existing projects to ensure this release won't break existing linters? I don't think it will, but would like to know.

davidlehn commented 2 years ago

Closing. May have been some local issue? Will revisit if needed.