Shopify’s TSlint rules and configs.
Install TSlint and tslint-config-shopify
:
With Yarn
yarn add --dev tslint tslint-config-shopify
With npm
npm install tslint tslint-config-shopify --save-dev
Shopify’s TSLint rules come bundled in tslint-config-shopify
.
To enable these rules, create a tslint.json
file at the root level of your project, and extend tslint-config-shopify
.
{
"extends": "tslint-config-shopify"
}
Now you can run TSLint by adding the following linting script to your package.json
. See here for more script configurations.
{
"scripts": {
"lint": "tslint './src/**/*.{ts,tsx}' --project tsconfig.json"
}
}
Run it:
With Yarn
yarn run tslint
With npm
npm run tslint
tslint.json
.Some of the rules configured in tslint-config-shopify
may not be sufficient for your project. You can override these rules in tslint.json
:
{
"extends": "tslint-config-shopify",
"rules": {
"no-console": false
}
}