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

Add linting #2

Open
kodie opened this issue Apr 18, 2022 · 4 comments
Open

Add linting #2

kodie opened this issue Apr 18, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@kodie
Copy link
Member

kodie commented Apr 18, 2022

In our original boilerplate we used the eslint Node module for code linting however, it was only for JavaScript. Then we switched all of our compiling tools to PHP and no longer had any sort of linting. My first plan was to implement linting in our Front End Compiler tool but then I decided it was best if that was kept separate.

So here we are. I'd like to implement linting in this boilerplate and the PHP_CodeSniffer tool seems like it's exactly what we want. It provides linting for PHP, JavaScript, and CSS which is awesome. So I'm just adding this to the to-do list.

@kodie kodie added the enhancement New feature or request label Apr 18, 2022
@kodie
Copy link
Member Author

kodie commented Apr 19, 2022

Upon further research, it appears PHP_CodeSniffer uses CSSLint for CSS Linting and JSHint for JavaScript which are both Node modules and we want to avoid having to install Node on websites.

Both of those modules support Mozilla Rhino which PHP_CodeSniffer also supports (For JSHint, I'm not 100% sure if you can use CSSLint through PHP_CodeSniffer using Rhino) but then that involves installing Java as well as Rhino which I'm not really a fan of.

We could possibly have JSHint, CSSLint, and Rhino downloaded as dependencies (probably in .lando.yml but it would be nice to have them pulled down via Composer) and have a prerequisite of Java installed if the linting feature is wanted.

I'm not sure, just writing my thoughts down to reference later.

@kodie
Copy link
Member Author

kodie commented Apr 19, 2022

Another option would be to simply require Node be installed on your machine as well as the CSSLint and JSHint packages be installed globally in order to take advantage of CSS and JavaScript linting and just use PHP_CodeSniffer for PHP. So these would be optional features. But if we go that route, maybe it would be worth using eslint again.

@kodie
Copy link
Member Author

kodie commented Apr 19, 2022

Something else worth noting, CSSLint doesn't support SCSS so that's not going to work. We would probably have to use something like stylelint which I think would also require stylelint-scss.

@kodie
Copy link
Member Author

kodie commented Apr 20, 2022

Another option would possibly be to package up stylelint as well as eslint using webpack and turn them into executables using pkg. From there we could make them Composer packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant