Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/carnesen/eslint-config
ESLint configurations for @carnesen projects
https://github.com/carnesen/eslint-config
Last synced: 26 days ago
JSON representation
ESLint configurations for @carnesen projects
- Host: GitHub
- URL: https://github.com/carnesen/eslint-config
- Owner: carnesen
- License: mit
- Created: 2019-02-02T19:03:35.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-05-03T20:39:09.000Z (6 months ago)
- Last Synced: 2024-09-30T06:57:13.595Z (about 1 month ago)
- Language: Shell
- Homepage:
- Size: 499 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
- License: license.md
Awesome Lists containing this project
README
ESLint configurations for `@carnesen` projects. This package is thoroughly documented, tested, and maintained. Feel free to use it in your own projects.
[![build status badge](https://github.com/carnesen/eslint-config/workflows/test/badge.svg)](https://github.com/carnesen/eslint-config/actions?query=workflow%3Atest+branch%3Amaster) [![npm version badge](https://badge.fury.io/js/eslint-config-carnesen.svg)](https://www.npmjs.com/package/eslint-config-carnesen) [![github stars badge](https://img.shields.io/github/stars/carnesen/eslint-config)](https://github.com/carnesen/eslint-config)
## Usage
To install this package as a dependency in your project, do:
```
npm install eslint-config-carnesen eslint
```Now create a file `.eslintrc.json` at the root of your project with contents:
```json
{
"extends": [
"eslint-config-carnesen"
]
}
```The main export `eslint-config-carnesen` has rules for Node.js and React. If your codebase is Node.js only, instead do:
```json
{
"extends": [
"eslint-config-carnesen/node.eslintrc.json"
]
}
```Or for React-only code:
```json
{
"extends": [
"eslint-config-carnesen/react.eslintrc.json"
]
}
```In any case, add these lines to your `package.json`'s "scripts" field:
```
"lint": "eslint --ext .js,.jsx,.ts,.tsx ",
"lint:fix": "npm run lint -- --fix",
```where `` is the subdirectory of your project containing the source code that you want to lint. Finally add `&& npm run lint` to your package's "test" script to make sure you don't forget to lint! I strongly recommend setting up your editor to automatically fix lint errors on save. That way the linter mostly stays out of your way and just does the right thing. In Visual Studio Code, [this plugin](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) works great.
## Rules
This package's rules extends those espoused by [by AirBnB](https://github.com/airbnb/javascript), consumed as [eslint-config-airbnb](https://www.npmjs.com/package/eslint-config-airbnb). Those rules are mostly concerned with syntax. For code formatting, this package uses [`eslint-config-prettier`](https://github.com/prettier/eslint-config-prettier), which disables all rules that are unnecessary or might conflict with [Prettier](https://prettier.io/). Instead of calling `prettier` directly, this package employs [`eslint-plugin-prettier`](https://github.com/prettier/eslint-plugin-prettier), which "runs Prettier as a ESLint rule and reports differences as individual ESLint issues". I wrote up some thoughts [here](https://github.com/googleapis/google-cloud-node/issues/2842#issuecomment-425229710) on why that's a much better approach than using `eslint` and `prettier` separately.
## More information
If you encounter any bugs or have any questions or feature requests, please don't hesitate to file an issue or submit a pull request on [this project's repository on GitHub](https://github.com/carnesen/eslint-config).
## Related
- [@carnesen/tsconfig](https://github.com/carnesen/tsconfig): TypeScript configurations for `@carnesen` projects
## License
MIT © [Chris Arnesen](https://www.carnesen.com)