14.1.1 • Published 3 years ago

eslint-config-motley v14.1.1

Weekly downloads
362
License
MIT
Repository
github
Last release
3 years ago

eslint-config-motley(-typescript)

Motley's JavaScript/TypeScript styleguide, using eslint and prettier with zero configuration. Based on eslint-config-airbnb.

Supports the following features out of the box:

  • Prettier autoformatting on precommit stage via husky.
  • ES2015+
  • Imports and exports
  • React
  • a11y
  • Full TypeScript support via the -typescript package
  • __DEV__ is a valid underscore-dangle value
  • js is a valid filename for JSX files (in JavaScript)

Note: Support for Node 6 dropped since version 10. Old projects should install eslint-config-motley@^9.

Installation

JavaScript

Run the following command:

npx install-peerdeps --dev eslint-config-motley

If you get prompted that do you want to use Yarn and nothing gets installed after that try following command:

npx install-peerdeps --dev eslint-config-motley --yarn

If all went well, you should see the following in your .eslintrc.js:

module.exports = {
  extends: 'motley',
};

TypeScript

Run the following command:

npx install-peerdeps --dev eslint-config-motley-typescript

If you get prompted that do you want to use Yarn and nothing gets installed after that try following command:

npx install-peerdeps --dev eslint-config-motley-typescript --yarn

If all went well, you should see the following in your .eslintrc.js:

module.exports = {
  extends: 'motley-typescript',
};

Post-install:

You should have the following set in .prettierrc;

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

and the following in your package.json:

{
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "*.{js,json,graphql,md,css,scss,less,ts}": ["prettier --write", "git add"]
  }
}

Using experimental JavaScript features with eslint-config-motley

If you are using experimental features such as class fields with JavaScript files you should install babel-eslint and add it as a parser to your .eslintrc.js:

npm install --save-dev babel-eslint

# or

yarn add babel-eslint -D
module.exports = {
  extends: 'motley',
  parser: 'babel-eslint',
};

NOTE: The TypeScript packages automatically uses @typescript-eslint/parser

Running tests

Tests use verdaccio as a local repository and jest for testing. The tests itself can be found under __tests__ and fixtures under __fixtures__. For local testing, you'll need Docker. Run the tests with

npm run test:local

The tests are also run in CI with GitHub Actions, as defined in .github/workflows.

Acknowledgements

We would like to thank the creators, maintainers and contributors of following libraries for making this possible:

14.1.1

3 years ago

14.1.0

3 years ago

14.0.0-alpha

3 years ago

14.0.0

3 years ago

13.1.0

3 years ago

13.0.1-alpha

3 years ago

13.0.2-alpha

3 years ago

13.0.3-alpha

3 years ago

13.0.0

4 years ago

13.0.0-alpha

4 years ago

12.0.1

4 years ago

12.0.0

4 years ago

12.0.0-alpha.14

4 years ago

12.0.0-alpha.13

4 years ago

12.0.0-alpha.12

4 years ago

12.0.0-alpha.11

4 years ago

12.0.0-alpha.9

4 years ago

12.0.0-alpha.10

4 years ago

12.0.0-alpha.8

4 years ago

12.0.0-alpha.7

4 years ago

12.0.0-alpha.6

5 years ago

12.0.0-alpha.5

5 years ago

12.0.0-alpha.4

5 years ago

12.0.0-alpha.3

5 years ago

12.0.0-alpha.2

5 years ago

12.0.0-alpha.1

5 years ago

11.1.1

5 years ago

11.1.0

5 years ago

11.0.0

5 years ago

10.0.2

6 years ago

10.0.1

6 years ago

10.0.0

6 years ago

9.2.0

6 years ago

9.1.0

6 years ago

9.0.0

6 years ago

8.0.1-rc1

6 years ago

8.0.1

7 years ago

8.0.0

7 years ago

7.3.0

7 years ago

7.2.0

7 years ago

7.1.1

7 years ago

7.1.0

7 years ago

7.0.2

7 years ago

7.0.1-rc3

7 years ago

7.0.1-rc2

7 years ago

7.0.1-rc1

7 years ago

7.0.0

7 years ago

6.1.0

7 years ago

6.0.1

7 years ago

6.0.0

7 years ago

5.0.0

7 years ago

4.0.1

7 years ago

4.0.0

8 years ago

2.0.0

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago