1.3.0 • Published 2 years ago

@condor-labs/eslint-config v1.3.0

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

This module defines ESLint rules to analyze the code in our projects.

See the official ESLint documentation here.

Compatibility

  • npm v7 or higher.

How to use it

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

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

For JavaScript projects:

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

For TypeScript projects:

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

Rules contained in this library. More information.

For JavaScript projects:

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 TypeScript projects:

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
  },
};

How to Publish

Increasing package version

You will need to update the package.json file placed in the root folder.

identify the property version and increase the right number in plus one.

Login in NPM by console.

 npm login
 [Enter username]
 [Enter password]
 [Enter email]

If all is ok the console will show you something like this : Logged in as USERNAME on https://registry.npmjs.org/.

Uploading a new version

 npm publish --access public

Ref: https://docs.npmjs.com/getting-started/publishing-npm-packages

Note: you will need to have a NPM account, if you don't have one create one here: https://www.npmjs.com/signup

Contributors

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

More about Condorlabs Here.

License

MIT

1.3.0

2 years ago

1.3.0-rc.1

2 years ago

1.2.0

3 years ago

1.2.0-beta.1

3 years ago

1.2.0-beta.0

3 years ago

1.2.0-beta.2

3 years ago

1.1.0

3 years ago

1.0.4-beta.1

3 years ago

1.0.0-v6

3 years ago

1.0.4

3 years ago

1.0.2

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago