2.0.2 • Published 12 months ago

@babybeet/eslint-config-base v2.0.2

Weekly downloads
-
License
-
Repository
github
Last release
12 months ago

eslint-config-base npm.io

Base ESLint rules that work well for any Typescript projects.

ESLint compatibility

This libraryESLint
2.x.x^9
1.x.x^8

Installation

  • npm
    npm i -S @babybeet/eslint-config-base
  • pnpm
    pnpm i -S @babybeet/eslint-config-base
  • yarn

    yarn add @babybeet/eslint-config-base

Setting up

ESLint 9

eslint.config.js file

const eslintConfigBase = require('@babybeet/eslint-config-base');

/**
 * @type {import('eslint').Linter.FlatConfig[]}
 */
module.exports = [
  ...eslintConfigBase.map(config => ({
    ...config,

    files: ['src/**/*.ts'], // Only lint Typescript files under `src` directory.

    rules: {
      ...config.rules
      // Your rule overrides go here
    }
  }))
];

If your package.json file has "type": "module", you can change the above require and module.exports to import and export default respectively.

ESLint 8

.eslintrc.json file

{
  "$schema": "https://json.schemastore.org/eslintrc.json",
  "root": true,
  "ignorePatterns": ["!**/*"],
  "parserOptions": {
    "ecmaVersion": "latest",
    "sourceType": "module"
  },
  // It's recommended to use an override to not globally change your ESLint configuration.
  "overrides": [
    {
      "files": ["*.ts"],
      "extends": ["@babybeet/eslint-config-base"],
      "rules": {
        // Add your own rule overrides if desired.
      }
    }
  ]
}