ESLint requires configuration via a .eslintrc.*
(for example .eslintrc.yml
) configuration file as detailed in ESLint's documentation.
If you don't specify your custom configuration file we use our default below. We suggest to add your own configuration file into your repository root directory to be able to specify your coding and quality standards.
env:
browser: true
es6: true
mocha: true
node: true
parser: "@babel/eslint-parser"
extends:
- "eslint:recommended"
- "plugin:react/recommended"
parserOptions:
ecmaVersion: 2020
sourceType: "module"
ecmaFeatures:
classes: true
jsx: true
rules:
brace-style:
- warn
- 1tbs
camelcase: warn
comma-dangle:
- warn
- always-multiline
comma-style:
- error
- last
complexity:
- error
- 10
curly: warn
eol-last:
- error
- always
id-length: error
max-lines: error
max-params:
- error
- 4
no-duplicate-imports: error
no-eq-null: error
eqeqeq:
- error
- smart
no-eval: error
no-implied-eval: error
no-invalid-this: error
no-shadow: error
no-undefined: error
no-empty-function: warn
no-extend-native: error
no-param-reassign: warn
no-unused-expressions: warn
no-useless-concat: warn
no-label-var: warn
no-use-before-define: error
no-const-assign: error
no-useless-constructor: warn
no-useless-rename: warn
no-warning-comments:
- warn
- location: anywhere
terms:
- todo
- fixme
prefer-promise-reject-errors: error
semi: error
settings:
react:
pragma: React
version: 17.0.1
To get started linting React applications, you can use the following ESLint configuration:
TSLint is deprecated for quite some time so we recommend using ESLint for TypeScript analysis. The setup is pretty straight forward. First you need to tell ESLint to analyze also .ts
files and disable TSLint. You can achieve that by adding .codeac.yml
into the root of your repository.
The last step is to teach ESLint understanding TypeScript with the official typescript-eslint plugin. Feel free to add more rules configuration such as the complexity one in the example below.
Storing generated or third party code in your repository is in general not a good idea. However, sometimes you really need to do this and Codeac got you covered. Usually you don't want to analyze those files so you can place .eslintignore
file to the root folder of your repository. This file can contain list of files that are ignored. Take a look on this simple example with jQuery and Bootstrap:
Our ESLint engine currently excludes all plugins except those listed below. This approach ensures that the supported plugins are secure and perform well within our environment. We also prioritize well-maintained plugins that are widely used by the community. Please see the list of supported plugins below:
If you need additional plugins, please share your use case with us at support@codeac.io, and we'll be happy to consider adding them.