https://github.com/fireworkweb/eslint-config
Custom eslint config for Firework projects
https://github.com/fireworkweb/eslint-config
Last synced: 8 months ago
JSON representation
Custom eslint config for Firework projects
- Host: GitHub
- URL: https://github.com/fireworkweb/eslint-config
- Owner: fireworkweb
- License: mit
- Created: 2020-03-31T21:22:48.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-03-26T10:34:30.000Z (over 4 years ago)
- Last Synced: 2025-07-03T04:39:14.159Z (12 months ago)
- Language: JavaScript
- Size: 163 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# @fireworkweb/eslint-config
Eslint rule configs for Javascript and Vue.js projects.
## Installation
To install, add it with `eslint` to your dev dependencies.
```bash
# With yarn
yarn add -D eslint @fireworkweb/eslint-config
# With npm
npm install --dev eslint @fireworkweb/eslint-config
```
## Usage
Currently there are two configs available: `js` for pure javascript projects, `vue` for Vue.js projects and `react` for React projects. The `vue` and `react` configs already includes the `js` config.
After installing, create a `.eslintrc.js` file and add this to your config (add only one):
```js
module.exports = {
extends: [
// for javascript project
'@fireworkweb/eslint-config/js',
// for vue project
'@fireworkweb/eslint-config/vue',
// for react project
'@fireworkweb/eslint-config/react',
],
};
```
Also, you should add this script to your `package.json`:
```json
{
// ...
"scripts": {
// ...
"lint": "eslint --ext js,vue,jsx ."
}
}
```
You should customize the extensions (`--ext` parameter) to fit your needs.
Then you can run `yarn lint` or `npm run lint`. To automatically fix some of the errors, you can add `--fix` to the lint command.
### Custom Rules
You can customize any rules ([js](https://eslint.org/docs/rules/), [vue](https://eslint.vuejs.org/rules/)), [react](https://github.com/yannickcr/eslint-plugin-react#list-of-supported-rules)) as this example:
```js
module.exports = {
extends: [
'@fireworkweb/eslint-config/js',
],
rules: {
'no-console': 'off',
},
};
```
You can also (and probably will) add any specific global variable:
```js
// for vue project
module.exports = {
extends: [
'@fireworkweb/eslint-config/vue',
],
globals: {
Vue: true, // if you set window.Vue
_: true, // lodash/underscore
Nova: true, // Laravel Nova
},
};
```
## License
[MIT](LICENSE.md).
## Collaborators
| [
@gabrielboliveira](https://github.com/gabrielboliveira) | [
@nkabz](https://github.com/nkabz) |
|:-:|:-:|