Changing Linter behaviour

Hi,

I’ve been playing with Trellis and Sage and so far, I really like it. Apart from one thing which is absolutely driving me insane.

  1. ESLint. I like having it, and it’s definitely useful to maintain the same syntax throughout, but is there a way to temporarily disable it? Or to maybe disable it for yarn start and enable it for yarn build? There are times where it can get really annoying, like if I’m debugging something and comment out a block or line of code and it starts giving errors like ‘variable declared but never used. Function blah declared but never used’. I just want it to transpile so that I can see what happens without that bit of code but at times like that ESLint seems just determined to get under my skin and further slow me down.

  2. StyleLint. This one is kind of making me doubt whether I’m in the wrong and not following best practices, but I’m gonna trust my gut and say that StyleLint is interpreting it wrongly. Let me know if you think the way I’m going about it is spaghetti haha. But I keep getting the ‘no-descending-specificity’ error with it. Of course, that’s usually something you want to avoid but the places I’m getting it would get harder to understand if I restructured the code to make it work without it.

E.g. at the start of the file I declare general styles for a list of posts, .post-list. Then underneath I declare styles for .hot-posts .post-list and .latest-posts .post-list where I change some specific styles for each of these contexts. But if there’s something in .hot-posts .post-list {} that is more specific than .latest-posts .post-list I get that error. I guess StyleLint doesn’t know that .hot-posts and .latest-posts aren’t referring to the same element(?). (Although even if I change them to IDs it gives that error so maybe that’s not why). But if I were to separate it so that it worked, I would need to keep switching between .latest-posts .post-list and .hot-posts .post-list

  1. How do I disable that rule? I’ve seen in other questions people have posted, the answer has been to change the package.json file and somewhere no-descending-specificity can be set to nullbut I don’t see that anywhere.

  2. By default, ESLint wants me to use single quotes, but StyleLint wants me to use double quotes and I would much rather use the same for both because it’s very easy to forget which is which. How do I change that?

  3. StyleLint gives an error message if there’s an “empty” line which has an indent. But if you move code around in VSCode with alt + arrow keys, it automatically indents empty lines that you pass so it’s a real pain. It also randomly deletes some spaces from time to time but I can’t figure out what causes it to do that. To be honest, I don’t really care about how consistent that is and it’s more headache than it’s worth in VSCode so I’d rather just disable that rule altogether. How can I do this?

Please help me, these issues are small but they’re slowly driving me insane. I usually have a linter plugin in VSCode but that lets me just ignore errors I don’t care about so I’ve never actually needed to change the options like this haha.

This topic was automatically closed after 42 days. New replies are no longer allowed.