eslint-config-codica

1.0.1 • Public • Published

eslint-config-codica

This package provides Codica's .eslintrc as an extensible shared config.

Usage

eslint-config-codica

Install the config via npm

npm install eslint-config-codica --save-dev

or via yarn

yarn add -D eslint-config-codica

Extend our config in your .eslintrc file:

{
  "extends": ["codica"]
}

Our config based on airbnb including some rewrites for ES6+ and React with config-prettier onboard. It requires eslint, eslint-plugin-import, eslint-plugin-prettier, eslint-plugin-react, and eslint-plugin-jsx-a11y.

To be sure, that you're using correct version of each package, you can list them by the command:

npm info "eslint-config-codica@latest" peerDependencies

If you don't need a React and Prettier onboard - eslint-config-codica-base and eslint-config-codica-react is coming soon!

Recommendations

Code formatting with Prettier

This config includes eslint-config-prettier and eslint-config-prettier/react. To feel up all advantages of automatic code formatting just add prettier to your project.

yarn add -D prettier

and add .prettierrc to your project root with such a config to avoid conflicts with airbnb and prettier eslint configs.

{
  "singleQuote": true,
  "trailingComma": "all"
}

Pre-commit hooks

The nice way to make your teammates or/and outstuff developers to push only valid and pretty code is to use pre-commit hooks using lint-staged and husky.

The configuration steps is next:

  1. Install packages:
yarn add -D husky lint-staged
  1. Add some configuration to rc files or to package.json directly:
{
  ...
  "scripts": {
    ...
    "lint:write": "./node_modules/.bin/eslint --debug . --fix",
    "prettier": "./node_modules/.bin/prettier --write ./**/*.js"
  },
  "lint-staged": {
    "*.(js|jsx)": [
      "yarn lint:write",
      "git add"
    ]
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  }
}
  1. You are beautiful! Next time you'll try to commit something, husky will hook up your commit and run eslint to validate all the new code!

License

eslint-config-codica is Copyright © 2015-2019 Codica. It is released under the MIT License.

About Codica

Codica logo

We love open source software! See our other projects or hire us to design, develop, and grow your product.

Package Sidebar

Install

npm i eslint-config-codica

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

6.09 kB

Total Files

6

Last publish

Collaborators

  • jk-volkov
  • dmitry_chekalin
  • amalinin
  • vai-vui