Reputation: 116
I'm currently setting up Gatsby to replace a previous Frontend setup in a Project Template my company users. Most things are set up but I'm stuck on integrating the linting into our deployment scripts.
Our bitbucket-pipelines.yml file calls npm run client:lint
to run the linting for the old setup. Gatsby has its own eslint setup which works great during development, but I can't find a way to run its linting manually.
The scripts setup by Gatsby in package.json only include these:
"scripts": {
"develop": "gatsby develop",
"start": "gatsby develop",
"build": "gatsby build",
"serve": "gatsby serve",
"clean": "gatsby clean"
},
Is there a command I can run to kick off the linting on its own?
Please Note: I've tried creating a custom eslint setup as per the below links, but it seemed to involve building a whole new eslint file - which I was having trouble with - So I'm hoping theres a script to run the existing linting for now that I simply haven't come across.
Upvotes: 2
Views: 754
Reputation: 29335
This should work:
"scripts": {
"develop": "gatsby develop",
"start": "gatsby develop",
"build": "gatsby build",
"serve": "gatsby serve",
"clean": "gatsby clean"
"eslint": "eslint \"**/*.{js, jsx, json, md}\"",
},
Use the eslint
command as you wish or combined with others. This will look for all the extensions (js
, jsx
, json
, md
) in any folder of the project and will apply the detailed rules in the ESLint configuration file (.eslintrc.json
).
It may be useful too adding a .eslintignore
file with the following content:
coverage
build/Release
node_modules/
jspm_packages/
build/
.cache/
public/
This will avoid the parsing of that folders while running the command.
Upvotes: 0