1.0.27 • Published 3 years ago

@scastro37/eslint-config v1.0.27

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

This module uses ESLint rules to analyze the code. It helps to search for errors in our project, using rules already defined in ESLint to be used in a simple way in different projects.

See official documentation here.

Compatibility

  • npm v7 or higher.

How to use it

To use the library you just need to follow the following steps:

  • Install the library with npm
npm i @scastro37/eslint-config
  • Create the file config .eslintrc.js and import the library:
├── Example Proyect
    ├── node_modules
    ├── src
    ├── package-lock.json
    ├── package.json
    └── .eslintrc.js

For poject JS(JavaScript)

module.exports = { extends: ['@scastro37/eslint-config/configJS'] };

For poject TS(TypeScript)

module.exports = { extends: ['@scastro37/eslint-config/configTS'] };

Rules contained in this library more information.

For poject JS(JavaScript).

const RULES = {
  OFF: "off",
  ERROR: "error",
  WARN: "warn",
};

module.exports = {
  env: {
    browser: true,
    commonjs: true,
    es6: true,
    node: true,
    jest: true,
  },
  extends: [
    "eslint:recommended",
    "plugin:react/recommended",
    "plugin:jsx-a11y/recommended",
    "prettier"
  ],
  settings: {
    react: {
      version: "detect",
    },
  },
  parser: "babel-eslint",
  parserOptions: {
    ecmaVersion: 8,
    ecmaFeatures: {
      jsx: true,
      experimentalObjectRestSpread: true,
    },
    sourceType: "module",
  },

  globals: {
    MyGlobal: true,
  },
  rules: {
    "no-console": RULES.WARN,
    "no-template-curly-in-string": RULES.WARN,
    "no-alert": RULES.ERROR,
    "no-eq-null": RULES.ERROR,
    "no-eval": RULES.ERROR,
    "no-implied-eval": RULES.ERROR,
    "no-iterator": RULES.ERROR,
    "no-lone-blocks": RULES.ERROR,
    "no-loop-func": RULES.ERROR,
    "no-param-reassign": RULES.ERROR,
    "no-proto": RULES.ERROR,
    "no-return-assign": RULES.ERROR,
    "no-script-url": RULES.ERROR,
    "no-self-compare": RULES.ERROR,
    "no-unused-expressions": RULES.ERROR,
    "no-useless-concat": RULES.ERROR,
    "no-undefined": RULES.ERROR,
    curly: RULES.ERROR,
    eqeqeq: RULES.ERROR,
    "no-else-return": RULES.ERROR,
    "no-useless-return": RULES.ERROR,
    "no-duplicate-imports": RULES.ERROR,
    "no-var": RULES.ERROR,
    "prefer-const": RULES.ERROR,
    "prefer-spread": RULES.WARN,
    "prefer-template": RULES.ERROR,
    "no-await-in-loop": RULES.WARN,
    "no-unreachable-loop": RULES.WARN,
  },
};

For poject TS(TypeScript).

const RULES = {
  OFF: "off",
  ERROR: "error",
  WARN: "warn",
};

module.exports = {
  env: {
    browser: true,
    commonjs: true,
    es6: true,
    node: true,
    jest: true,
  },
  extends: [
    "eslint:recommended",
    "plugin:react/recommended",
    "plugin:jsx-a11y/recommended",
    "plugin:@typescript-eslint/eslint-recommended",
    "plugin:@typescript-eslint/recommended",
    "prettier",
  ],
  settings: {
    react: {
      version: "detect",
    },
  },
  parser: "@typescript-eslint/parser",
  parserOptions: {
    ecmaVersion: 8,
    ecmaFeatures: {
      jsx: true,
      experimentalObjectRestSpread: true,
    },
    sourceType: "module",
  },

  globals: {
    MyGlobal: true,
  },
  rules: {
    "no-console": RULES.WARN,
    "no-template-curly-in-string": RULES.WARN,
    "no-alert": RULES.ERROR,
    "no-eq-null": RULES.ERROR,
    "no-eval": RULES.ERROR,
    "no-implied-eval": RULES.ERROR,
    "no-iterator": RULES.ERROR,
    "no-lone-blocks": RULES.ERROR,
    "no-loop-func": RULES.ERROR,
    "no-param-reassign": RULES.ERROR,
    "no-proto": RULES.ERROR,
    "no-return-assign": RULES.ERROR,
    "no-script-url": RULES.ERROR,
    "no-self-compare": RULES.ERROR,
    "no-unused-expressions": RULES.ERROR,
    "no-useless-concat": RULES.ERROR,
    "no-undefined": RULES.ERROR,
    curly: RULES.ERROR,
    eqeqeq: RULES.ERROR,
    "no-else-return": RULES.ERROR,
    "no-useless-return": RULES.ERROR,
    "no-duplicate-imports": RULES.ERROR,
    "no-var": RULES.ERROR,
    "prefer-const": RULES.ERROR,
    "prefer-spread": RULES.WARN,
    "prefer-template": RULES.ERROR,
    "no-await-in-loop": RULES.WARN,
    "no-unreachable-loop": RULES.WARN
  },
};

Contributors

The original author and current lead maintainer of this module is the @condor-labs development team.

More about Condorlabs Here.

License

MIT

1.0.27

3 years ago

1.0.26

3 years ago

1.0.25

3 years ago

1.0.24

3 years ago

1.0.19

3 years ago

1.0.22

3 years ago

1.0.21

3 years ago

1.0.20

3 years ago

1.0.23

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.9

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.0

3 years ago