@crometrics/eslint-config-crometrics-base

3.2.1 • Public • Published

eslint-config-crometrics-base

Contains the Cro Metrics' JavaScript linting rules for ESLint.

The intent of our ESLint configs is to provide a common set of rules for coding within the Cro Metrics' codebase. Having installable ESLint configs will streamline and simplify using our style guide across various projects/repos easier.

Installation and Ussage Instructions

  1. Run npx install-peerdeps @crometrics/eslint-config-crometrics-base@latest
  2. Add the package to the extends array/string in your .eslintrc.*.

Example

An example bare bones .eslintrc.* config with no other rules, plugins, extended configs, etc. would look like:

// .eslintrc.cjs

module.exports = {
  extends: ['@crometrics/eslint-config-crometrics-base'],
  overrides: [],
};

Override specific settings by specifying them in the rules object as normal. See http://eslint.org/docs/developer-guide/shareable-configs for more details.

You can add additional extended configs, plugins, rules, globals, parser options, env options, etc. the same as you normally would.

Example

// eslintrc.cjs

module.exports = {
  extends: [
    '@crometrics/eslint-config-crometrics-base',
    'plugin:react/recommended',
  ],
  plugins: ['react'],
  rules: {
    // Any project specific rules or rules for plugins/additional configs here
    'react/no-unescaped-entities': ['off'],
  },
  globals: {
    // Add any project globals here
    PJS: true,
  },
};

Available Configs

See eslint-config-crometrics/packages/ to view all available configs.

Of note, there is a TypeScript configuration for projects that contain any amount of TypeScript.

  • If your project is only JavaScript:
    • Install only this module
  • If your project contains any TypeScript:
    • Install only eslint-config-crometrics-typescript (Link)

IMPORTANT NOTE:

There is no reason to install both eslint-config-crometrics-base and eslint-config-crometrics-typescript in the same project and doing so will give you problems.

Making Changes and Publishing Updates

  1. Make the changes you want to make in /packages/eslint-config-crometrics-base/index.js or /packages/eslint-config-crometrics-base/rules/[filename].js.
  2. Increment version in package.json.
  3. Commit and push changes to the repo.
  4. From the root directory of this repo, run npm publish to publish from the repo to npm.
  5. Run npm update @crometrics/eslint-config-crometrics-base (or simply npm update to update all npm packages) in the projects where the config is installed
  6. Make a post in the #-engineering Slack channel informing others to run npm update @crometrics/eslint-config-crometrics-typescript or npm update as well

Dependencies (0)

    Dev Dependencies (6)

    Package Sidebar

    Install

    npm i @crometrics/eslint-config-crometrics-base

    Weekly Downloads

    71

    Version

    3.2.1

    License

    MIT

    Unpacked Size

    10.3 kB

    Total Files

    11

    Last publish

    Collaborators

    • mrjoshuasperry
    • rpzigler
    • shixish