Skip to content

Commit

Permalink
Merge branch 'master' into feature/635-add-readonlyArray-option
Browse files Browse the repository at this point in the history
  • Loading branch information
bradzacher committed Jul 21, 2019
2 parents d500798 + 4933ade commit b5d2dfd
Show file tree
Hide file tree
Showing 40 changed files with 371 additions and 247 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,27 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [1.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.12.0...v1.13.0) (2019-07-21)


### Bug Fixes

* Correct `@types/json-schema` dependency ([#675](https://github.com/typescript-eslint/typescript-eslint/issues/675)) ([a5398ce](https://github.com/typescript-eslint/typescript-eslint/commit/a5398ce))
* **eslint-plugin:** remove imports from typescript-estree ([#706](https://github.com/typescript-eslint/typescript-eslint/issues/706)) ([ceb2d32](https://github.com/typescript-eslint/typescript-eslint/commit/ceb2d32)), closes [#705](https://github.com/typescript-eslint/typescript-eslint/issues/705)
* **eslint-plugin:** undo breaking changes to recommended config ([93f72e3](https://github.com/typescript-eslint/typescript-eslint/commit/93f72e3))
* **utils:** move `typescript` from peer dep to dev dep ([#712](https://github.com/typescript-eslint/typescript-eslint/issues/712)) ([f949355](https://github.com/typescript-eslint/typescript-eslint/commit/f949355))
* **utils:** RuleTester should not require a parser ([#713](https://github.com/typescript-eslint/typescript-eslint/issues/713)) ([158a417](https://github.com/typescript-eslint/typescript-eslint/commit/158a417))


### Features

* **eslint-plugin:** add new rule no-misused-promises ([#612](https://github.com/typescript-eslint/typescript-eslint/issues/612)) ([28a131d](https://github.com/typescript-eslint/typescript-eslint/commit/28a131d))
* **eslint-plugin:** add new rule require-await ([#674](https://github.com/typescript-eslint/typescript-eslint/issues/674)) ([807bc2d](https://github.com/typescript-eslint/typescript-eslint/commit/807bc2d))





# [1.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.11.0...v1.12.0) (2019-07-12)


Expand Down
2 changes: 0 additions & 2 deletions azure-pipelines.yml
Expand Up @@ -62,8 +62,6 @@ jobs:
node_version: 10.x
node_8_x:
node_version: 8.x
node_6_x:
node_version: 6.x
steps:
- task: NodeTool@0
inputs:
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
@@ -1,5 +1,5 @@
{
"version": "1.12.0",
"version": "1.13.0",
"npmClient": "yarn",
"useWorkspaces": true,
"stream": true
Expand Down
5 changes: 3 additions & 2 deletions package.json
Expand Up @@ -31,7 +31,8 @@
"lint-fix": "eslint . --ext .js,.ts --fix",
"pre-commit": "yarn lint-staged",
"pre-push": "yarn format-check",
"postinstall": "lerna bootstrap && yarn build && lerna link",
"postinstall": "lerna bootstrap && yarn build && lerna link && npm run check-clean-workspace-after-install",
"check-clean-workspace-after-install": "git diff --quiet --exit-code",
"test": "lerna run test --parallel",
"typecheck": "lerna run typecheck"
},
Expand Down Expand Up @@ -64,7 +65,7 @@
"all-contributors-cli": "^6.0.0",
"babel-code-frame": "^6.26.0",
"cz-conventional-changelog": "2.1.0",
"eslint": "^5.12.1",
"eslint": "^6.0.0",
"eslint-plugin-eslint-plugin": "^2.0.1",
"eslint-plugin-jest": "^22.2.2",
"glob": "7.1.2",
Expand Down
11 changes: 11 additions & 0 deletions packages/eslint-plugin-tslint/CHANGELOG.md
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [1.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.12.0...v1.13.0) (2019-07-21)


### Bug Fixes

* Correct `@types/json-schema` dependency ([#675](https://github.com/typescript-eslint/typescript-eslint/issues/675)) ([a5398ce](https://github.com/typescript-eslint/typescript-eslint/commit/a5398ce))





# [1.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.11.0...v1.12.0) (2019-07-12)


Expand Down
8 changes: 4 additions & 4 deletions packages/eslint-plugin-tslint/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/eslint-plugin-tslint",
"version": "1.12.0",
"version": "1.13.0",
"main": "dist/index.js",
"typings": "src/index.ts",
"description": "TSLint wrapper plugin for ESLint",
Expand Down Expand Up @@ -31,15 +31,15 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@typescript-eslint/experimental-utils": "1.12.0",
"@typescript-eslint/experimental-utils": "1.13.0",
"lodash.memoize": "^4.1.2"
},
"peerDependencies": {
"eslint": "^5.0.0",
"eslint": "^5.0.0 || ^6.0.0",
"tslint": "^5.0.0"
},
"devDependencies": {
"@types/lodash.memoize": "^4.1.4",
"@typescript-eslint/parser": "1.12.0"
"@typescript-eslint/parser": "1.13.0"
}
}
5 changes: 4 additions & 1 deletion packages/eslint-plugin-tslint/tests/index.spec.ts
@@ -1,4 +1,5 @@
import { TSESLint } from '@typescript-eslint/experimental-utils';
import * as parser from '@typescript-eslint/parser';
import { readFileSync } from 'fs';
import rule, { Options } from '../src/rules/config';

Expand All @@ -13,7 +14,7 @@ const ruleTester = new TSESLint.RuleTester({
*/
project: './tests/tsconfig.json',
},
parser: '@typescript-eslint/parser',
parser: require.resolve('@typescript-eslint/parser'),
});

/**
Expand Down Expand Up @@ -146,6 +147,7 @@ describe('tslint/error', () => {
function testOutput(code: string, config: TSESLint.Linter.Config): void {
const linter = new TSESLint.Linter();
linter.defineRule('tslint/config', rule);
linter.defineParser('@typescript-eslint/parser', parser);

expect(() => linter.verify(code, config)).toThrow(
`You must provide a value for the "parserOptions.project" property for @typescript-eslint/parser`,
Expand Down Expand Up @@ -176,6 +178,7 @@ describe('tslint/error', () => {
const linter = new TSESLint.Linter();
jest.spyOn(console, 'warn').mockImplementation();
linter.defineRule('tslint/config', rule);
linter.defineParser('@typescript-eslint/parser', parser);
expect(() =>
linter.verify('foo;', {
parserOptions: {
Expand Down
19 changes: 19 additions & 0 deletions packages/eslint-plugin/CHANGELOG.md
Expand Up @@ -3,6 +3,25 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [1.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.12.0...v1.13.0) (2019-07-21)


### Bug Fixes

* Correct `@types/json-schema` dependency ([#675](https://github.com/typescript-eslint/typescript-eslint/issues/675)) ([a5398ce](https://github.com/typescript-eslint/typescript-eslint/commit/a5398ce))
* **eslint-plugin:** remove imports from typescript-estree ([#706](https://github.com/typescript-eslint/typescript-eslint/issues/706)) ([ceb2d32](https://github.com/typescript-eslint/typescript-eslint/commit/ceb2d32)), closes [#705](https://github.com/typescript-eslint/typescript-eslint/issues/705)
* **eslint-plugin:** undo breaking changes to recommended config ([93f72e3](https://github.com/typescript-eslint/typescript-eslint/commit/93f72e3))


### Features

* **eslint-plugin:** add new rule no-misused-promises ([#612](https://github.com/typescript-eslint/typescript-eslint/issues/612)) ([28a131d](https://github.com/typescript-eslint/typescript-eslint/commit/28a131d))
* **eslint-plugin:** add new rule require-await ([#674](https://github.com/typescript-eslint/typescript-eslint/issues/674)) ([807bc2d](https://github.com/typescript-eslint/typescript-eslint/commit/807bc2d))





# [1.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.11.0...v1.12.0) (2019-07-12)


Expand Down
6 changes: 3 additions & 3 deletions packages/eslint-plugin/package.json
@@ -1,6 +1,6 @@
{
"name": "@typescript-eslint/eslint-plugin",
"version": "1.12.0",
"version": "1.13.0",
"description": "TypeScript plugin for ESLint",
"keywords": [
"eslint",
Expand Down Expand Up @@ -40,7 +40,7 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@typescript-eslint/experimental-utils": "1.12.0",
"@typescript-eslint/experimental-utils": "1.13.0",
"eslint-utils": "^1.3.1",
"functional-red-black-tree": "^1.0.1",
"regexpp": "^2.0.1",
Expand All @@ -54,6 +54,6 @@
},
"peerDependencies": {
"@typescript-eslint/parser": "^1.9.0",
"eslint": "^5.0.0"
"eslint": "^5.0.0 || ^6.0.0"
}
}
4 changes: 1 addition & 3 deletions packages/eslint-plugin/src/configs/base.json
Expand Up @@ -3,7 +3,5 @@
"parserOptions": {
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
]
"plugins": ["@typescript-eslint"]
}
3 changes: 2 additions & 1 deletion packages/eslint-plugin/src/configs/recommended.json
Expand Up @@ -7,7 +7,6 @@
"camelcase": "off",
"@typescript-eslint/camelcase": "error",
"@typescript-eslint/class-name-casing": "error",
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/explicit-function-return-type": "warn",
"@typescript-eslint/explicit-member-accessibility": "error",
"indent": "off",
Expand All @@ -25,11 +24,13 @@
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/no-object-literal-type-assertion": "error",
"@typescript-eslint/no-parameter-properties": "error",
"@typescript-eslint/no-triple-slash-reference": "error",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "warn",
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-interface": "error",
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/type-annotation-spacing": "error"
}
Expand Down
6 changes: 3 additions & 3 deletions packages/eslint-plugin/src/rules/array-type.ts
Expand Up @@ -72,11 +72,11 @@ function typeNeedsParentheses(node: TSESTree.Node): boolean {
}
}

export type ArrayOption = 'array' | 'generic' | 'array-simple';
export type OptionString = 'array' | 'generic' | 'array-simple';
type Options = [
{
default: ArrayOption;
readonly?: ArrayOption;
default: OptionString;
readonly?: OptionString;
}
];
type MessageIds =
Expand Down
Expand Up @@ -226,12 +226,10 @@ export default util.createRule<Options, MessageIds>({
return;
}

if (util.isTypeScriptFile(context.getFilename())) {
context.report({
node,
messageId: 'missingReturnType',
});
}
context.report({
node,
messageId: 'missingReturnType',
});
}

/**
Expand Down
109 changes: 51 additions & 58 deletions packages/eslint-plugin/src/rules/explicit-member-accessibility.ts
Expand Up @@ -119,30 +119,27 @@ export default util.createRule<Options, MessageIds>({
return;
}

if (util.isTypeScriptFile(context.getFilename())) {
// const methodName = util.getNameFromPropertyName(methodDefinition.key);
const methodName = util.getNameFromClassMember(
const methodName = util.getNameFromClassMember(
methodDefinition,
sourceCode,
);
if (
check === 'no-public' &&
methodDefinition.accessibility === 'public'
) {
reportIssue(
'unwantedPublicAccessibility',
nodeType,
methodDefinition,
sourceCode,
methodName,
);
} else if (check === 'explicit' && !methodDefinition.accessibility) {
reportIssue(
'missingAccessibility',
nodeType,
methodDefinition,
methodName,
);
if (
check === 'no-public' &&
methodDefinition.accessibility === 'public'
) {
reportIssue(
'unwantedPublicAccessibility',
nodeType,
methodDefinition,
methodName,
);
} else if (check === 'explicit' && !methodDefinition.accessibility) {
reportIssue(
'missingAccessibility',
nodeType,
methodDefinition,
methodName,
);
}
}
}

Expand All @@ -155,26 +152,24 @@ export default util.createRule<Options, MessageIds>({
): void {
const nodeType = 'class property';

if (util.isTypeScriptFile(context.getFilename())) {
const propertyName = util.getNameFromPropertyName(classProperty.key);
if (
propCheck === 'no-public' &&
classProperty.accessibility === 'public'
) {
reportIssue(
'unwantedPublicAccessibility',
nodeType,
classProperty,
propertyName,
);
} else if (propCheck === 'explicit' && !classProperty.accessibility) {
reportIssue(
'missingAccessibility',
nodeType,
classProperty,
propertyName,
);
}
const propertyName = util.getNameFromPropertyName(classProperty.key);
if (
propCheck === 'no-public' &&
classProperty.accessibility === 'public'
) {
reportIssue(
'unwantedPublicAccessibility',
nodeType,
classProperty,
propertyName,
);
} else if (propCheck === 'explicit' && !classProperty.accessibility) {
reportIssue(
'missingAccessibility',
nodeType,
classProperty,
propertyName,
);
}
}

Expand All @@ -186,24 +181,22 @@ export default util.createRule<Options, MessageIds>({
node: TSESTree.TSParameterProperty,
) {
const nodeType = 'parameter property';
if (util.isTypeScriptFile(context.getFilename())) {
// HAS to be an identifier or assignment or TSC will throw
if (
node.parameter.type !== AST_NODE_TYPES.Identifier &&
node.parameter.type !== AST_NODE_TYPES.AssignmentPattern
) {
return;
}
// HAS to be an identifier or assignment or TSC will throw
if (
node.parameter.type !== AST_NODE_TYPES.Identifier &&
node.parameter.type !== AST_NODE_TYPES.AssignmentPattern
) {
return;
}

const nodeName =
node.parameter.type === AST_NODE_TYPES.Identifier
? node.parameter.name
: // has to be an Identifier or TSC will throw an error
(node.parameter.left as TSESTree.Identifier).name;
const nodeName =
node.parameter.type === AST_NODE_TYPES.Identifier
? node.parameter.name
: // has to be an Identifier or TSC will throw an error
(node.parameter.left as TSESTree.Identifier).name;

if (paramPropCheck === 'no-public' && node.accessibility === 'public') {
reportIssue('unwantedPublicAccessibility', nodeType, node, nodeName);
}
if (paramPropCheck === 'no-public' && node.accessibility === 'public') {
reportIssue('unwantedPublicAccessibility', nodeType, node, nodeName);
}
}

Expand Down

0 comments on commit b5d2dfd

Please sign in to comment.