@pragmatics/eslint-config
v1.1.3
Published
Pragmatic eslint config enforcing an understandable and consistent code style.
Downloads
9
Maintainers
Readme
ESlint config
Stylelint config enforcing an understandable and consistent code style.
Summary
Getting started
Installation
The default config uses Prettier and Jest, when using the default configuration install:
yarn add eslint @pragmatics/eslint-config prettier jest eslint-plugin-jest -D
Custom configuration
When using a custom configuration install:
yarn add eslint @pragmatics/eslint-config -D
Depending on the configutation, you might need to install additional dependencies.
Usage
To consume and extend a config in ESLint just add the extends attribute to your .eslintrc
.
For more details about how shareable configs work, see the ESLint documentation.
Default configuration
---
extends:
- '@pragmatics'
All configurations
Default configuration uses @pragmatics/config/es6-browser-recommended
@pragmatics
- ES6 + browser + prettier + test
You can also use one or more custom configurations:
@pragmatics/config/browser
- browser@pragmatics/config/node
- node@pragmatics/config/test
- test@pragmatics/config/es6
- ES6@pragmatics/config/es6-browser
- ES6 + browser@pragmatics/config/es6-browser-recommended
- ES6 + browser + prettier + test@pragmatics/config/es6-node
- ES6 + node@pragmatics/config/es6-browser-recommended
- ES6 + node + prettier + test
Dependencies
Depending on the configutation you choose, might need to install additional dependencies.
Test configuration
When using a configuration which uses test install the following extra dependencies:
yarn jest eslint-plugin-jest -D
Recommended configuration
When using a recommended configuration install the following extra dependency:
yarn prettier -D
Automation
We recommend configuring your editor to automatically format your code by on save.
You can use Prettier and Eslint with a pre-commit tool. This can re-format your files that are marked as “staged” via git add before you commit.
Make sure Prettier and Stylelint are installed and in your devDependencies before you proceed
npx mrm lint-staged
This will install husky and lint-staged, then add a configuration to the project’s package.json that will automatically format supported files in a pre-commit hook.
{
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.js": "eslint --fix",
"*": "prettier --write --ignore-unknown"
}
}
Testing
We use Jest for testing, run npm test
to run all tests.
Vision
Built With
- Webstorm - for development
- Github - for versioning and deployment
- Jest - for testing
- Contributor Covenant - for the Code of Conduct
- Creative Commons - to choose the license
Contributing
Please read CONTRIBUTING.md for details on our the process for submitting issues and pull requests to us. This repository has a code of conduct, we will remove things that do not respect it.
Versioning
We use SemVer for versioning. For the available versions, see the tags on this repository.
Authors
See the list of contributors who participated in this project.
License
This project is licensed under the ISC License.
Acknowledgements
The following sources have been used as inspiration for this package: