When using a .eslintrc.json file to change the default linting rules of the editor, it does not apply any overrides; e.g. if i configure a linting rule like the below, it will give warnings in all files (even the ones that should be set to off):
I also tried to make use of configuration cascading as an alternative. However, it does not seem like the editor uses any .eslintrc.json files placed in subdirectories.
The only thing that works is to use a configuration comment in all files where I want to set the rule to off; i.e. /* eslint sort-keys: "off" */.
This, however, also has its limitations; it only works if I want to set my rule to off. If I set a rule to warn or error, e.g. /* eslint sort-keys: "warn" */, the editor will give the following error:
Configuration for rule "sort-keys" is invalid:
Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'
https://apis.google.com
https://cdnjs.cloudflare.com
https://cdn.segment.com
https://*.woopra.com
'sha256-aROmP5KBVON8dHdF7kTobxNwhI67hJuBpk+jNh/jbM4='
'sha256-lIXJkTrfgeKmujhwsIkqzNbMkplZdPFm1ERXsf46uOw='
'sha256-To0Iwo79L42agXa29pvaAn64gM4rwT1BflbRPGdqcUg='
'sha256-IWN+DH0UXsSKPql06C66AvLM8/jMYbOe+wVRfPlzHDY='
http://www.luckyorange.com https://ssl.luckyorange.com https://d10lpsik1i8c69.cloudfront.net
https://www.google.com
https://www.gstatic.com
https://cdn.amplitude.com".
Can you let me know the name of the project so I can take a look? If it’s private, or you just don’t want to share here, can you email [email protected] with the name of the project (say that I sent you!) and I’ll figure out what’s going on there.
I’m not seeing any errors in either of those files, so something tells me something else is triggering the editor to pay attention to the config files properly. I’ll play around with this more to see why that’s going on. Do you still see errors?
The js linting in the editor looks like it uses this special package built for browsers. The sample I see on the readme doesn’t show where to put additional directory-specific configs, so that might be a limitation that makes the folder/file.js one not work right. That doesn’t fully explain why the some.config.js one doesn’t work, but maybe it’s another similar limitation.
Glitch looks like it has a flag to have it do linting on the server side, which I remixed your project to try to turn that on.
Yeah I didn’t realize I needed to edit the file before the errors showed up, that’s weird! I’m asking some folks on the eng team if they can help me diagnose this for you.
That flag won’t work in watch.json we decided not to do linting on the back-end (and should probably remove it).
I’ll take a look at the rules needed to get it working in sub-directories the way you’d expect, @wh0 is right that we’re running a wrapper library so that it gets injected into the front end (for instant linting, instead of needing a round trip to the server)