2.0.1 • Published 2 years ago

eslint-config-utility v2.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

eslint-config-utility

This is a utility config that provides a custom .eslintrc and .prettierrc config.

Getting started

Installation:

npm i -D eslint-config-utility@latest

Run the following command and install packages provided as dev dependencies:

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

Usage

This package exports three utility tools for use.

eslint-config-utility

The default export contains basic ESLint rules, which can be extended by adding additional rules.

Add "extends": "utility" to your .eslintrc.

module.exports = {
  extends: ['utility'],
};

If you are using typescript with @typescript-eslint rules then it's recommended to add path to tsconfig.json to parserOptions in .eslintrc file as follows:

module.exports = {
  extends: ['utility'],
  parserOptions: {
    project: './tsconfig.json'
  },
};

Normally tsconfig.json is at the root of the project as above, except in few cases.

Then create a .eslintignore file and add the following files to ignore that applies to your project: node_modules, .eslintrc.json or .eslintrc.js, build/, coverage/, dist/, .env etc.

.eslintrc.json
.eslintrc.js
.env
node_modules/
build/
coverage/
dist/

If you want, you can extend the rules, by adding additional rules, for example:

module.exports = {
  extends: ['utility'],
  parserOptions: {
    project: './tsconfig.json'
  },
  rules: {
    'no-console': 2,
  },
};

You can check that the package lints using:

npx eslint .

or with the fix flag:

npx eslint . --fix

eslint-config-utility/import

The import, helps sort and order imports, into files. To use the import sort order, add "extends": ["utility", "utility/import"] to your .eslintrc.

module.exports = {
  extends: ['utility', 'utility/import'],
  parserOptions: {
    project: './tsconfig.json'
  },
};

You can check that the imports are sorted and ordered using npx eslint . --fix.

npx eslint . --fix

eslint-config-utility/prettier

The prettier helps with code formatting. To use the prettier functionality, create a .prettierrc.js and import the prettier file. Add module.exports = require('eslint-config-utility/prettier.config'); to your .prettierrc.

module.exports = require('eslint-config-utility/prettier.config');

Check that prettier formats the code using npx prettier . --write.

npx prettier . --write

More information

See eslint-config-utility.

See Github.

2.0.1

2 years ago

2.0.0

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago