eslint-config-codfish
ESLint configuration extending airbnb & prettier.
Last updated 3 months ago by codfish .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install eslint-config-codfish 
SYNC missed versions from official npm registry.

eslint-config-codfish semantic-release Commitizen friendly

Opinionated ESLint configuration that extends airbnb to not conflict with prettier.

Features

  • Uses Airbnb's config as the foundation.
  • Leverages prettier's eslint plugin, which run's prettier within ESLint, and overrides ESLint/Airbnb rules that may conflict with Prettier.
  • Supports both React & non-React applications dynamically based on your project's dependencies.
  • Extends Kent C Dodd's Jest config dynamically based on your project's dependencies.
  • Helpful opt-in config for apps using Docker.
  • Helpful opt-in config for dApp's.

Install

Install dependencies:

npm install --save-dev --save-exact prettier
npx install-peerdeps --dev eslint-config-codfish

Usage

My recommended setup includes tools like husky, lint-staged & commitlint in addition to prettier & eslint. However that's optional.

.eslintrc.js

module.exports = {
  extends: ['codfish'],
  rules: {
    // your overrides here
  },
};

.prettierrc.js

module.exports = {
  singleQuote: true,
  trailingComma: 'all',
  printWidth: 100,
};

.package.json

{
  "scripts": {
    "fix": "npm run format && npm run lint -- --fix",
    "format": "prettier --write \"**/*.{json,css,scss,html}\"",
    "lint": "eslint ."
  }
}

Run npm run fix from a git hook.

Run npm run lint in a ci/cd environment.

With Docker

Using Docker? node_modules should be installed and present in your containers, but not needed/mounted on the host machine. ESLint will complain about this however because it won't be able to resolve the dependencies locally. Pull in the docker ruleset to adjust some rules to prevent these types of failures.

NOTE: All this config basically does is ignore the import/no-unresolved rule for imports that don't start with a period.

module.exports = {
  extends: ['codfish', 'codfish/docker'],
  rules: {
    // your overrides here
  },
};

With dApps

Similar to the issues with docker, there may be rules you want to adjust for dApp's. This config will set some globals as well as ignore missing build artifact imports. While you obviously need those to run your app, sometimes you might want to run the linter in a ci/cd environment and build artifacts might not be present.

Note: The dApp config also includes the import/no-unresolved rule found in the docker config.

module.exports = {
  extends: ['codfish', 'codfish/dapp'],
  rules: {
    // your overrides here
  },
};

Current Tags

  • 2.5.0                                ...           latest (3 months ago)

9 Versions

  • 2.5.0                                ...           3 months ago
  • 2.4.0                                ...           4 months ago
  • 2.3.0                                ...           4 months ago
  • 2.2.0                                ...           5 months ago
  • 2.1.0                                ...           6 months ago
  • 2.0.0                                ...           6 months ago
  • 1.1.1                                ...           6 months ago
  • 1.1.0                                ...           7 months ago
  • 1.0.0                                ...           7 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dev Dependencies (7)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |