Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: typescript-eslint/typescript-eslint
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.2.0
Choose a base ref
...
head repository: typescript-eslint/typescript-eslint
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.3.0
Choose a head ref
  • 10 commits
  • 42 files changed
  • 8 contributors

Commits on Sep 12, 2019

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b99e831 View commit details
  2. Copy the full SHA
    b49dbfd View commit details
  3. Copy the full SHA
    5715482 View commit details
  4. Copy the full SHA
    c713ca4 View commit details
  5. Copy the full SHA
    6a55921 View commit details
  6. feat(eslint-plugin): [explicit-member-accessibility] add support of "…

    …ignoredMethodNames" (#895)
    lonyele authored and JamesHenry committed Sep 12, 2019
    Copy the full SHA
    46ee4c9 View commit details
  7. Copy the full SHA
    aeea4cd View commit details

Commits on Sep 13, 2019

  1. Copy the full SHA
    2bf8231 View commit details

Commits on Sep 15, 2019

  1. Copy the full SHA
    752fb31 View commit details

Commits on Sep 16, 2019

  1. chore: publish v2.3.0

    JamesHenry committed Sep 16, 2019
    Copy the full SHA
    fa1cf71 View commit details
Showing with 1,057 additions and 109 deletions.
  1. +14 −0 .vscode/launch.json
  2. +20 −0 CHANGELOG.md
  3. +48 −2 README.md
  4. +1 −1 lerna.json
  5. +6 −1 package.json
  6. +8 −0 packages/eslint-plugin-tslint/CHANGELOG.md
  7. +3 −3 packages/eslint-plugin-tslint/package.json
  8. +20 −0 packages/eslint-plugin/CHANGELOG.md
  9. +1 −0 packages/eslint-plugin/README.md
  10. +20 −0 packages/eslint-plugin/docs/rules/explicit-member-accessibility.md
  11. +30 −0 packages/eslint-plugin/docs/rules/no-floating-promises.md
  12. +28 −0 packages/eslint-plugin/docs/rules/no-magic-numbers.md
  13. +64 −0 packages/eslint-plugin/docs/rules/no-unnecessary-condition.md
  14. +3 −0 packages/eslint-plugin/docs/rules/strict-boolean-expressions.md
  15. +1 −1 packages/eslint-plugin/docs/rules/typedef.md
  16. +2 −2 packages/eslint-plugin/package.json
  17. +1 −0 packages/eslint-plugin/src/configs/all.json
  18. +14 −4 packages/eslint-plugin/src/rules/explicit-member-accessibility.ts
  19. +2 −0 packages/eslint-plugin/src/rules/index.ts
  20. +82 −59 packages/eslint-plugin/src/rules/no-floating-promises.ts
  21. +25 −0 packages/eslint-plugin/src/rules/no-magic-numbers.ts
  22. +192 −0 packages/eslint-plugin/src/rules/no-unnecessary-condition.ts
  23. +35 −3 packages/eslint-plugin/src/rules/strict-boolean-expressions.ts
  24. +1 −2 packages/eslint-plugin/src/rules/triple-slash-reference.ts
  25. +60 −0 packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts
  26. +8 −0 packages/eslint-plugin/tests/rules/no-floating-promises.test.ts
  27. +44 −0 packages/eslint-plugin/tests/rules/no-magic-numbers.test.ts
  28. +195 −0 packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts
  29. +28 −0 packages/eslint-plugin/tests/rules/strict-boolean-expressions.test.ts
  30. +1 −0 packages/eslint-plugin/typings/eslint-rules.d.ts
  31. +8 −0 packages/experimental-utils/CHANGELOG.md
  32. +2 −2 packages/experimental-utils/package.json
  33. +8 −0 packages/parser/CHANGELOG.md
  34. +3 −1 packages/parser/README.md
  35. +4 −4 packages/parser/package.json
  36. +8 −0 packages/shared-fixtures/CHANGELOG.md
  37. +1 −1 packages/shared-fixtures/package.json
  38. +11 −0 packages/typescript-estree/CHANGELOG.md
  39. +2 −2 packages/typescript-estree/package.json
  40. +37 −0 packages/typescript-estree/src/WatchCompilerHostOfConfigFile.ts
  41. +1 −1 packages/typescript-estree/src/ts-estree/ts-estree.ts
  42. +15 −20 packages/typescript-estree/src/tsconfig-parser.ts
14 changes: 14 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -18,6 +18,20 @@
"sourceMaps": true,
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"type": "node",
"request": "launch",
"name": "Run currently opened typescript-estree test",
"cwd": "${workspaceFolder}/packages/typescript-estree/",
"program": "${workspaceFolder}/node_modules/jest/bin/jest.js",
"args": [
"--runInBand",
"${relativeFile}"
],
"sourceMaps": true,
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,26 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [2.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.2.0...v2.3.0) (2019-09-16)


### Bug Fixes

* **typescript-estree:** ImportDeclaration.specifier to Literal ([#974](https://github.com/typescript-eslint/typescript-eslint/issues/974)) ([2bf8231](https://github.com/typescript-eslint/typescript-eslint/commit/2bf8231))


### Features

* **eslint-plugin:** [explicit-member-accessibility] add support of "ignoredMethodNames" ([#895](https://github.com/typescript-eslint/typescript-eslint/issues/895)) ([46ee4c9](https://github.com/typescript-eslint/typescript-eslint/commit/46ee4c9))
* **eslint-plugin:** [no-floating-promises] Add ignoreVoid option ([#796](https://github.com/typescript-eslint/typescript-eslint/issues/796)) ([6a55921](https://github.com/typescript-eslint/typescript-eslint/commit/6a55921))
* **eslint-plugin:** [no-magic-numbers] add ignoreReadonlyClassProperties option ([#938](https://github.com/typescript-eslint/typescript-eslint/issues/938)) ([aeea4cd](https://github.com/typescript-eslint/typescript-eslint/commit/aeea4cd))
* **eslint-plugin:** [strict-boolean-expressions] Add allowNullable option ([#794](https://github.com/typescript-eslint/typescript-eslint/issues/794)) ([c713ca4](https://github.com/typescript-eslint/typescript-eslint/commit/c713ca4))
* **eslint-plugin:** add no-unnecessary-condition rule ([#699](https://github.com/typescript-eslint/typescript-eslint/issues/699)) ([5715482](https://github.com/typescript-eslint/typescript-eslint/commit/5715482))





# [2.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.1.0...v2.2.0) (2019-09-09)


50 changes: 48 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@

<p align="center">
<a href="https://dev.azure.com/typescript-eslint/TypeScript%20ESLint/_build/latest?definitionId=1&branchName=master"><img src="https://img.shields.io/azure-devops/build/typescript-eslint/TypeScript%20ESLint/1/master.svg?label=%F0%9F%9A%80%20Azure%20Pipelines&style=flat-square" alt="Azure Pipelines"/></a>
<a href="https://opencollective.com/typescript-eslint" alt="Financial Contributors on Open Collective"><img src="https://opencollective.com/typescript-eslint/all/badge.svg?label=financial+contributors&style=flat-square" /></a>
<a href="https://github.com/typescript-eslint/typescript-eslint/blob/master/LICENSE"><img src="https://img.shields.io/npm/l/typescript-estree.svg?style=flat-square" alt="GitHub license" /></a>
<a href="https://www.npmjs.com/package/@typescript-eslint/typescript-estree"><img src="https://img.shields.io/npm/dm/@typescript-eslint/typescript-estree.svg?style=flat-square" alt="NPM Downloads" /></a>
<a href="https://codecov.io/gh/typescript-eslint/typescript-eslint"><img alt="Codecov" src="https://img.shields.io/codecov/c/github/typescript-eslint/typescript-eslint.svg?style=flat-square"></a>
@@ -60,6 +61,14 @@ Palantir, the backers behind TSLint announced earlier this year that **they woul

The TypeScript Team themselves also announced their plans to move the TypeScript codebase from TSLint to `typescript-eslint`, and they have been big supporters of this project. More details at https://github.com/microsoft/TypeScript/issues/30553

### Migrating from TSLint to ESLint

If you are looking for help in migrating from TSLint to ESLint, you can check out this project: https://github.com/typescript-eslint/tslint-to-eslint-config

You can look at [`the plugin ROADMAP.md`](./packages/eslint-plugin/ROADMAP.md) for an up to date overview of how TSLint rules compare to the ones in this package.

There is also the ultimate fallback option of using both linters together for a while during your transition if you absolutely have to by using TSLint _within_ ESLint. For this option, check out [`@typescript-eslint/eslint-plugin-tslint`](./packages/eslint-plugin-tslint/).

<br>

## How does `typescript-eslint` work and why do you have multiple packages?
@@ -161,6 +170,8 @@ See an issue? Report it in as much detail as possible, ideally with a clear and

If you have the time and the inclination, you can even take it a step further and submit a PR to improve the project.

There are also financial ways to contribute, please see [Financial Contributors](#Financial-Contributors) for more details.

All positive contributions are welcome here!

<br>
@@ -223,9 +234,44 @@ TypeScript ESLint inherits from the the original TypeScript ESLint Parser licens

<br>

## Contributors
## Code Contributors

This project exists thanks to every one of the awesome people who contribute code and documentation:

<br>

<a href="https://github.com/typescript-eslint/typescript-eslint/graphs/contributors"><img src="https://opencollective.com/typescript-eslint/contributors.svg?width=890&button=false" /></a>

<br>

🙏 An extra special thanks goes out to the wonderful people listed in [`CONTRIBUTORS.md`](./CONTRIBUTORS.md)

<br>

## Financial Contributors

In addition to submitting code and documentation updates, you can help us sustain our community by becoming a financial contributor [[Click here to contribute - every little helps!](https://opencollective.com/typescript-eslint/contribute)]

<br>

### Individuals

<a href="https://opencollective.com/typescript-eslint"><img src="https://opencollective.com/typescript-eslint/individuals.svg?width=890"></a>

### Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [[Click here to contribute - every little helps!](https://opencollective.com/typescript-eslint/contribute)]

Thanks goes to the wonderful people listed in [`CONTRIBUTORS.md`](./CONTRIBUTORS.md).
<a href="https://opencollective.com/typescript-eslint/organization/0/website"><img src="https://opencollective.com/typescript-eslint/organization/0/avatar.svg"></a>
<a href="https://opencollective.com/typescript-eslint/organization/1/website"><img src="https://opencollective.com/typescript-eslint/organization/1/avatar.svg"></a>
<a href="https://opencollective.com/typescript-eslint/organization/2/website"><img src="https://opencollective.com/typescript-eslint/organization/2/avatar.svg"></a>
<a href="https://opencollective.com/typescript-eslint/organization/3/website"><img src="https://opencollective.com/typescript-eslint/organization/3/avatar.svg"></a>
<a href="https://opencollective.com/typescript-eslint/organization/4/website"><img src="https://opencollective.com/typescript-eslint/organization/4/avatar.svg"></a>
<a href="https://opencollective.com/typescript-eslint/organization/5/website"><img src="https://opencollective.com/typescript-eslint/organization/5/avatar.svg"></a>
<a href="https://opencollective.com/typescript-eslint/organization/6/website"><img src="https://opencollective.com/typescript-eslint/organization/6/avatar.svg"></a>
<a href="https://opencollective.com/typescript-eslint/organization/7/website"><img src="https://opencollective.com/typescript-eslint/organization/7/avatar.svg"></a>
<a href="https://opencollective.com/typescript-eslint/organization/8/website"><img src="https://opencollective.com/typescript-eslint/organization/8/avatar.svg"></a>
<a href="https://opencollective.com/typescript-eslint/organization/9/website"><img src="https://opencollective.com/typescript-eslint/organization/9/avatar.svg"></a>

<br>

2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.2.0",
"version": "2.3.0",
"npmClient": "yarn",
"useWorkspaces": true,
"stream": true
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@
"lint-fix": "eslint . --ext .js,.ts --fix",
"pre-commit": "yarn lint-staged",
"pre-push": "yarn format-check",
"postinstall": "lerna bootstrap && yarn build && lerna link && npm run check-clean-workspace-after-install",
"postinstall": "lerna bootstrap && yarn build && lerna link && npm run check-clean-workspace-after-install && opencollective-postinstall",
"check-clean-workspace-after-install": "git diff --quiet --exit-code",
"test": "lerna run test --parallel",
"typecheck": "lerna run typecheck"
@@ -68,11 +68,16 @@
"jest": "^24.9.0",
"lerna": "^3.16.4",
"lint-staged": "^9.2.5",
"opencollective-postinstall": "^2.0.2",
"prettier": "^1.18.2",
"rimraf": "^3.0.0",
"ts-jest": "^24.0.0",
"ts-node": "^8.3.0",
"tslint": "^5.19.0",
"typescript": ">=3.2.1 <3.7.0"
},
"collective": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
}
8 changes: 8 additions & 0 deletions packages/eslint-plugin-tslint/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [2.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.2.0...v2.3.0) (2019-09-16)

**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint





# [2.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.1.0...v2.2.0) (2019-09-09)

**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint
6 changes: 3 additions & 3 deletions packages/eslint-plugin-tslint/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/eslint-plugin-tslint",
"version": "2.2.0",
"version": "2.3.0",
"main": "dist/index.js",
"typings": "src/index.ts",
"description": "TSLint wrapper plugin for ESLint",
@@ -31,7 +31,7 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@typescript-eslint/experimental-utils": "2.2.0",
"@typescript-eslint/experimental-utils": "2.3.0",
"lodash.memoize": "^4.1.2"
},
"peerDependencies": {
@@ -41,6 +41,6 @@
},
"devDependencies": {
"@types/lodash.memoize": "^4.1.4",
"@typescript-eslint/parser": "2.2.0"
"@typescript-eslint/parser": "2.3.0"
}
}
20 changes: 20 additions & 0 deletions packages/eslint-plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,26 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [2.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.2.0...v2.3.0) (2019-09-16)


### Bug Fixes

* **typescript-estree:** ImportDeclaration.specifier to Literal ([#974](https://github.com/typescript-eslint/typescript-eslint/issues/974)) ([2bf8231](https://github.com/typescript-eslint/typescript-eslint/commit/2bf8231))


### Features

* **eslint-plugin:** [explicit-member-accessibility] add support of "ignoredMethodNames" ([#895](https://github.com/typescript-eslint/typescript-eslint/issues/895)) ([46ee4c9](https://github.com/typescript-eslint/typescript-eslint/commit/46ee4c9))
* **eslint-plugin:** [no-floating-promises] Add ignoreVoid option ([#796](https://github.com/typescript-eslint/typescript-eslint/issues/796)) ([6a55921](https://github.com/typescript-eslint/typescript-eslint/commit/6a55921))
* **eslint-plugin:** [no-magic-numbers] add ignoreReadonlyClassProperties option ([#938](https://github.com/typescript-eslint/typescript-eslint/issues/938)) ([aeea4cd](https://github.com/typescript-eslint/typescript-eslint/commit/aeea4cd))
* **eslint-plugin:** [strict-boolean-expressions] Add allowNullable option ([#794](https://github.com/typescript-eslint/typescript-eslint/issues/794)) ([c713ca4](https://github.com/typescript-eslint/typescript-eslint/commit/c713ca4))
* **eslint-plugin:** add no-unnecessary-condition rule ([#699](https://github.com/typescript-eslint/typescript-eslint/issues/699)) ([5715482](https://github.com/typescript-eslint/typescript-eslint/commit/5715482))





# [2.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.1.0...v2.2.0) (2019-09-09)


1 change: 1 addition & 0 deletions packages/eslint-plugin/README.md
Original file line number Diff line number Diff line change
@@ -177,6 +177,7 @@ Then you should add `airbnb` (or `airbnb-base`) to your `extends` section of `.e
| [`@typescript-eslint/no-require-imports`](./docs/rules/no-require-imports.md) | Disallows invocation of `require()` | | | |
| [`@typescript-eslint/no-this-alias`](./docs/rules/no-this-alias.md) | Disallow aliasing `this` | :heavy_check_mark: | | |
| [`@typescript-eslint/no-type-alias`](./docs/rules/no-type-alias.md) | Disallow the use of type aliases | | | |
| [`@typescript-eslint/no-unnecessary-condition`](./docs/rules/no-unnecessary-condition.md) | Prevents conditionals where the type is always truthy or always falsy | | | :thought_balloon: |
| [`@typescript-eslint/no-unnecessary-qualifier`](./docs/rules/no-unnecessary-qualifier.md) | Warns when a namespace qualifier is unnecessary | | :wrench: | :thought_balloon: |
| [`@typescript-eslint/no-unnecessary-type-arguments`](./docs/rules/no-unnecessary-type-arguments.md) | Warns if an explicitly specified type argument is the default for that type parameter | | :wrench: | :thought_balloon: |
| [`@typescript-eslint/no-unnecessary-type-assertion`](./docs/rules/no-unnecessary-type-assertion.md) | Warns if a type assertion does not change the type of an expression | :heavy_check_mark: | :wrench: | :thought_balloon: |
20 changes: 20 additions & 0 deletions packages/eslint-plugin/docs/rules/explicit-member-accessibility.md
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@ type AccessibilityLevel =

type Options = {
accessibility?: AccessibilityLevel;
ignoredMethodNames?: string[];
overrides?: {
accessors?: AccessibilityLevel;
constructors?: AccessibilityLevel;
@@ -310,6 +311,25 @@ class Animal {
}
```

### Except specific methods

If you want to ignore some specific methods, you can do it by specifing method names. Note that this option does not care for the context, and will ignore every method with these names, which could lead to it missing some cases. You should use this sparingly.
e.g. `[ { ignoredMethodNames: ['specificMethod', 'whateverMethod'] } ]`

```ts
class Animal {
get specificMethod() {
console.log('No error because you specified this method on option');
}
get whateverMethod() {
console.log('No error because you specified this method on option');
}
public get otherMethod() {
console.log('This method comply with this rule');
}
}
```

## When Not To Use It

If you think defaulting to public is a good default, then you should consider using the `no-public` setting. If you want to mix implicit and explicit public members then disable this rule.
30 changes: 30 additions & 0 deletions packages/eslint-plugin/docs/rules/no-floating-promises.md
Original file line number Diff line number Diff line change
@@ -36,6 +36,36 @@ returnsPromise().then(() => {}, () => {});
Promise.reject('value').catch(() => {});
```

## Options

The rule accepts an options object with the following properties:

```ts
type Options = {
// if true, checking void expresions will be skipped
ignoreVoid?: boolean;
};

const defaults = {
ignoreVoid: false,
};
```

### ignoreVoid

This allows to easily suppress false-positives with void operator.

Examples of **correct** code for this rule with `{ ignoreVoid: true }`:

```ts
async function returnsPromise() {
return 'value';
}
void returnsPromise();

void Promise.reject('value');
```

## When Not To Use It

If you do not use Promise-like values in your codebase or want to allow them to
28 changes: 28 additions & 0 deletions packages/eslint-plugin/docs/rules/no-magic-numbers.md
Original file line number Diff line number Diff line change
@@ -41,6 +41,34 @@ Examples of **correct** code for the `{ "ignoreNumericLiteralTypes": true }` opt
type SmallPrimes = 2 | 3 | 5 | 7 | 11;
```

### ignoreReadonlyClassProperties

Examples of **incorrect** code for the `{ "ignoreReadonlyClassProperties": false }` option:

```ts
/*eslint @typescript-eslint/no-magic-numbers: ["error", { "ignoreReadonlyClassProperties": false }]*/

class Foo {
readonly A = 1;
readonly B = 2;
public static readonly C = 1;
static readonly D = 1;
}
```

Examples of **correct** code for the `{ "ignoreReadonlyClassProperties": true }` option:

```ts
/*eslint @typescript-eslint/no-magic-numbers: ["error", { "ignoreReadonlyClassProperties": true }]*/

class Foo {
readonly A = 1;
readonly B = 2;
public static readonly C = 1;
static readonly D = 1;
}
```

### ignoreEnums

A boolean to specify if enums used in Typescript are considered okay. `false` by default.
Loading