Skip to content

@JamesHenry JamesHenry released this Aug 13, 2019 · 50 commits to master since this release

2.0.0 (2019-08-13)

BREAKING CHANGES

  • Node 6 is no longer supported.
  • parser / typescript-estree:
    • When project is specified within parserOptions, we will now hard fail when parsing files that are not included within the provided tsconfig(s).
    • We discovered that this was a common performance pitfall, and could increase lint times by huge amounts.
    • To handle this, there are a few possible solutions:
      1. Improve the includes field within your tsconfig(s) so that all the files you want to lint are included.
      2. Create a new tsconfig.eslint.json which you pass into parserOptions.project, which includes all of the files you want to lint, e.g.:
        {
          // extend your base config so you don't have to redefine your compilerOptions
          "extends": "./tsconfig.json",
          "include": [
            "src/**/*.ts",
            "test/**/*.ts",
            "typings/**/*.ts"
            // etc
          ],
          // IF (and only if) you have a mixed JS/TS codebase - you should also turn on JS support
          "compilerOptions": {
            "allowJs": true,
            "checkJs": true
          }
        }
        If you are using non standard file extensions (i.e. .vue files), you should add the following config to your .eslintrc file:
        {
          "parserOptions": {
            "extraFileExtensions": [".vue"]
          }
        }
  • eslint-plugin:
    • Removed hardcoded checks which prevented some rules from running on non-TypeScript files (i.e. files that are not *.ts/*.tsx).
      • Some users with mixed TS/JS codebases may now see some TypeScript-specific rules being reported against JS files.
      • Please use ESLint's "overrides" config to select which files to apply rules to.
    • Removed deprecated rule prefer-interface. This rule was replaced by consistent-type-definitions.
    • Removed deprecated rule no-triple-slash-reference. This rule was replaced by triple-slash-reference
    • Merged both no-angle-bracket-type-assertion and no-object-literal-type-assertion into one rule - consistent-type-assertions.
    • explicit-function-return-type no longer treats export default () => {} as an expression for the purposes of the allowExpressions option.
    • Changed a number of the default rule configs:
      • explicit-function-return-type - allowTypedFunctionExpressions and allowHigherOrderFunctions are now both true by default.
      • no-inferrable-types - ignoreParameters and ignoreProperties are now both false by default.
      • no-this-alias - allowDestructuring is now true by default.
    • Reworked the recommended configs:
      • plugin:@typescript-eslint/recommended
        • This is our slim, recommended set of rules. This config does not require type information, so it can be easily dropped into an existing config.
      • plugin:@typescript-eslint/recommended-requiring-type-checking
        • This is a slightly expanded set of rules, intended to be used in conjunction with plugin:@typescript-eslint/recommended. These rules specifically require type information. We separated these rules into a separate config to ease adoption and to make the base recommended "fast-by-default".
      • plugin:@typescript-eslint/eslint-recommended
        • This config is a compatibility config that disables rules from eslint:recommended which are already handled by TypeScript.
      • plugin:@typescript-eslint/all
        • This config simply turns on every single rule available in the plugin.
      • The intention is that you can use all the configs together, as they build upon one-another:
        {
          "extends": [
            "eslint:recommended",
            "plugin:@typescript-eslint/eslint-recommended",
            "plugin:@typescript-eslint/recommended",
            "plugin:@typescript-eslint/recommended-requiring-type-checking"
          ]
        }

Bug Fixes

  • eslint-plugin: [efrt] flag default export w/ allowExpressions (#831) (ebbcc01)
  • eslint-plugin: [no-explicit-any] Fix ignoreRestArgs for interfaces (#777) (22e9ae5)
  • eslint-plugin: [no-useless-constructor] handle bodyless constructor (#685) (55e788c)
  • eslint-plugin: [prefer-readonly] TypeError when having computed member expression (#761) (211b1b5)
  • eslint-plugin: [typedef] support for..in, for..of (#787) (39e41b5)
  • eslint-plugin: [typedef] support default value for parameter (#785) (84916e6)
  • eslint-plugin: add Literal to RuleListener types (#824) (3c902a1)
  • typescript-estree: fix is token typed as Keyword (#750) (35dec52)
  • typescript-estree: jsx comment parsing (#703) (0cfc48e)
  • utils: add ES2019 as valid ecmaVersion (#746) (d11fbbe)

Features

  • explicitly support eslint v6 (#645) (34a7cf6)
  • eslint-plugin: [interface-name-prefix, class-name-casing] Add allowUnderscorePrefix option to support private declarations (#790) (0c4f474)
  • eslint-plugin: [no-var-requires] report on foo(require('')) (#725) (b2ca20d), closes #665
  • eslint-plugin: [promise-function-async] make allowAny default true (#733) (590ca50)
  • eslint-plugin: [strict-boolean-expressions] add ignoreRhs option (#691) (fd6be42)
  • eslint-plugin: add support for object props in CallExpressions (#728) (8141f01)
  • eslint-plugin: added new rule typedef (#581) (35cc99b)
  • eslint-plugin: added new rule use-default-type-parameter (#562) (2b942ba)
  • eslint-plugin: move opinionated rules between configs (#595) (4893aec)
  • eslint-plugin: remove deprecated rules (#739) (e32c7ad)
  • eslint-plugin: [array-type] rework options (#654) (1389393), closes #654 #635
  • eslint-plugin: add rule consistent-type-assertions (#731) (92e98de), closes #731
  • eslint-plugin: change recommended config (#729) (428567d), closes #729
  • eslint-plugin: recommended-requiring-type-checking config (#846) (d3470c9), closes #846
  • typescript-estree: throw error on file not in project when project set (#760) (3777b77), closes #760
Assets 2
You can’t perform that action at this time.