Giter Club home page Giter Club logo

Comments (3)

iamturns avatar iamturns commented on June 26, 2024

Hey @David-Else - thanks for looking into this!

This library uses @typescript-eslint/parser as a local dependency, so there is no need to install it yourself.

Ideally, this would also be the case for ESLint configs and plugins, but ESLint requires them to be in the root.

If uninstalling @typescript-eslint/parser breaks something, that would be unexpected - let me know! Cheers

from eslint-config-airbnb-typescript.

David-Else avatar David-Else commented on June 26, 2024

I read your link, what a messed up situation! Thanks for setting me straight.

from eslint-config-airbnb-typescript.

David-Else avatar David-Else commented on June 26, 2024

@iamturns I thought about it more, and now my entire config is in doubt! I would be really grateful if you could take a look and tell me if what I have done is correct and I have no unnecessary duplication or mistakes/suboptimal settings.

I think I need to include @typescript-eslint/parser in my package.json for the other plugins? Does your extension already include any of the @typescript-eslint rules I am adding in my extends?

I would like:

  • The recommended eslint rules
  • The @typescript-eslint/recommended rules including those that require type checking
  • Your airbnb rules
  • All the prettier style overrides from eslint-config-prettier
  • My own additional rules

My package.json:

  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^3.1.0",
    "@typescript-eslint/parser": "^3.1.0",
    "eslint": "^7.1.0",
    "eslint-config-airbnb-typescript": "^8.0.2",
    "eslint-config-prettier": "^6.11.0",
    "eslint-plugin-import": "^2.20.2",
    "rollup": "^2.13.1",
    "typescript": "^3.9.3"
  }

and .eslintrc.js

module.exports = {
  root: true,
  parser: "@typescript-eslint/parser",
  parserOptions: {
    // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
    tsconfigRootDir: __dirname,
    project: ["./tsconfig.json"],
  },
  plugins: ["@typescript-eslint"],
  extends: [
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended",
    "plugin:@typescript-eslint/recommended-requiring-type-checking",
    "airbnb-typescript/base",
    "prettier",
    "prettier/@typescript-eslint",
  ],
  rules: {
    "import/prefer-default-export": "off",
    "no-console": "off",
    "max-lines-per-function": [
      "error",
      {
        max: 50,
        skipBlankLines: true,
        skipComments: true,
        IIFEs: true,
      },
    ],
    "@typescript-eslint/lines-between-class-members": "off",
    "@typescript-eslint/no-unnecessary-condition": "error",
    "@typescript-eslint/no-unnecessary-qualifier": "error",
    "@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
    "@typescript-eslint/no-unnecessary-type-arguments": "error",
    "@typescript-eslint/no-dynamic-delete": "error",
    "@typescript-eslint/no-require-imports": "error",
    "@typescript-eslint/no-throw-literal": "error",
    "@typescript-eslint/prefer-readonly": "error",
    "@typescript-eslint/prefer-readonly-parameter-types": "error",
    "@typescript-eslint/prefer-nullish-coalescing": "error",
    "@typescript-eslint/prefer-optional-chain": "error",
    "@typescript-eslint/prefer-string-starts-ends-with": "error",
    "@typescript-eslint/prefer-ts-expect-error": "error",
    "@typescript-eslint/consistent-type-assertions": "error",
    "@typescript-eslint/consistent-type-definitions": ["error", "interface"],
    "@typescript-eslint/member-delimiter-style": "error",
    "@typescript-eslint/method-signature-style": "error",
    "@typescript-eslint/array-type": "error",
    "@typescript-eslint/switch-exhaustiveness-check": "error",
  },
};

THANKS!!

from eslint-config-airbnb-typescript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.