bedrock icon indicating copy to clipboard operation
bedrock copied to clipboard

Add linters for a consistent codebase

Open thomastuts opened this issue 9 years ago • 18 comments

We talked about this briefly in Slack - the mix of using double and single quotes in our Jade templates right now is pretty awful. We don't have to limit ourselves to just Jade linting, though:

  • Jade: https://github.com/emartech/gulp-jade-lint
  • JS: http://eslint.org/
  • SCSS: https://github.com/brigade/scss-lint

thomastuts avatar Dec 07 '15 13:12 thomastuts

Yes... I agree we need to have some code linting. But let's not forget we are sometimes designing/prototyping here.

Let's add the linting as an optional step that reports on your code, not as a requirement.

Wolfr avatar Dec 07 '15 13:12 Wolfr

I would start with making it mandatory first. If we run into issues we can make it optional?

xavez avatar Dec 07 '15 14:12 xavez

No, my experience is that you run into issues where third party code is written in a way that makes it impossible for you to continue without refactoring their code. Especially with Javascript.

Wolfr avatar Dec 07 '15 14:12 Wolfr

We can exclude third party code from linting, which is good practice anyway I think.

xavez avatar Dec 07 '15 15:12 xavez

Yes, third-party code should definitely not be linted. That's their responsibility. They might also use other rules, so it definitely doesn't make sense to lint that stuff ourselves.

thomastuts avatar Dec 07 '15 15:12 thomastuts

OK sure, but really there are more pressing issues than consistency of single quotes and double quotes.

On Mon, Dec 7, 2015 at 4:02 PM, Thomas Tuts [email protected] wrote:

Yes, third-party code should definitely not be linted. That's their responsibility. They might also use other rules, so it definitely doesn't make sense to lint that stuff ourselves.

— Reply to this email directly or view it on GitHub https://github.com/mono-company/bedrock/issues/49#issuecomment-162549284 .

Wolfr avatar Dec 07 '15 15:12 Wolfr

What I would like is a linter that checks for invalid HTML like $("a a"). We had this in Ticketmatic. See this code https://gist.github.com/Wolfr/00d425420bc83ff2e89d . It used cheerio ( https://github.com/cheeriojs/cheerio ) .

Wolfr avatar Dec 18 '15 10:12 Wolfr

@thomastuts seemingly I already linked the relevant code from this issue.

Wolfr avatar Jan 16 '17 16:01 Wolfr

Linting is broken (see #174 ) but still a feature I would like to have in general to ensure more code quality.

Wolfr avatar Sep 28 '17 13:09 Wolfr

SCSS lint seems to be deprecated.

Wolfr avatar Sep 28 '17 14:09 Wolfr

I would still like linting when we get back to implementing new features.

Wolfr avatar Jan 18 '18 20:01 Wolfr

It would be nice if we could perhaps add support for https://prettier.io. It goes a step further than simple linting, but I think it can be pretty powerful to avoid mistakes and silly whitespace diffs :-)

xavez avatar Jun 28 '18 15:06 xavez

I think it can be done - we can experiment with it and decide if it should be part of Bedrock core.

One problem with prettier is that there is no support for my editor Textmate2, so I effectively can’t use it

Verstuurd vanaf mijn iPhone

Op 28 jun. 2018 om 17:19 heeft Xavier Bertels [email protected] het volgende geschreven:

It would be nice if we could perhaps add support for https://prettier.io. It goes a step further than simple linting, but I think it can be pretty powerful to avoid mistakes and silly whitespace diffs :-)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

Wolfr avatar Jun 28 '18 16:06 Wolfr

And I was hoping that 8 supported editors would be enough 😢. Definitely a thing to consider.

xavez avatar Jun 28 '18 16:06 xavez

Since I can’t be a user maybe it’s something you can add at some point?

I will just conform to the rules set in the spec ;)

I tried switching to VScode 2 weeks ago but there’s just too many textmate things I know to be productive

Verstuurd vanaf mijn iPhone

Op 28 jun. 2018 om 18:56 heeft Xavier Bertels [email protected] het volgende geschreven:

And I was hoping that 8 supported editors would be enough 😢. Definitely a thing to consider.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

Wolfr avatar Jun 28 '18 19:06 Wolfr

Closing due to stale.

Wolfr avatar Feb 16 '19 15:02 Wolfr

I am actively working on this again because I actually needed it to validate some code.

Wolfr avatar Feb 19 '19 16:02 Wolfr

At this moment, it works for components in the branch https://github.com/usebedrock/bedrock/tree/feature/linternew

Wolfr avatar Feb 19 '19 16:02 Wolfr