@lamiaoy/eslint-config v3.0.0
@lamiaoy/eslint-config
Base ESLint config for Lamia projects
Install
With npm do:
npm install -D @lamiaoy/eslint-config
Create a .eslintrc.js
to your project root with the following contents:
module.exports = {
extends: '@lamiaoy/eslint-config'
};
Make sure you don't have any existing configs (.eslintrc.js
, .eslintrc.yml
, .eslintrc.json
or similar).
If you do, first merge their configurations into the new .eslintrc.js
, and remove them afterwards.
Assuming ESLint is configured correctly, it should automatically pick up the new config.
Usage
You can configure PhpStorm to show lint errors in the IDE.
You should also add a convenience command to your package.json
...
"scripts": {
"lint": "npm run lint:js && npm run lint:css"
"lint:js": "eslint src/",
"lint:css": "..." // Some CSS linter
}
...
Run the command with
$ npm run lint
You can also add a prepush
hook through husky
"scripts": {
"prepush": "npm run lint"
}
This will lint your code before pushing to BitBucket.
Override config
You can add / remove rules and environment configs freely in .eslintrc.js
.
module.exports = {
extends: '@lamiaoy/eslint-config',
env: {
browser: true // Allow browser globals, such as 'window' and 'document'
},
rules: {
'no-console': 'off' // Allow console.log -statements in your code
}
};
You can see the full list of available rules here.
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago