From 6975ef8e4200f614a026853bd57ea773475d8a08 Mon Sep 17 00:00:00 2001 From: Armano Date: Sun, 20 Jan 2019 01:08:58 +0100 Subject: [PATCH 1/8] build: add linting to build workflow --- .eslintignore | 8 +++ .eslintrc.json | 68 +++++++++++++++++++ azure-pipelines.yml | 4 ++ package.json | 4 ++ .../tests/ast-alignment/utils.ts | 2 +- yarn.lock | 10 +++ 6 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 .eslintignore create mode 100644 .eslintrc.json diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000000..58fa04212589 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,8 @@ +node_modules +dist +jest.config.js +fixtures +coverage + +packages/typescript-estree/src/estree +packages/eslint-plugin-tslint/tests diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 000000000000..6c87aaec59ad --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,68 @@ +{ + "root": true, + "plugins": ["eslint-plugin", "@typescript-eslint", "jest"], + "env": { + "es6": true, + "node": true + }, + "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"], + "rules": { + "no-mixed-operators": "error", + "no-console": "off", + "no-undef": "off", + "@typescript-eslint/indent": "off", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/explicit-member-accessibility": "off", + "@typescript-eslint/no-var-requires": "off", + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/no-object-literal-type-assertion": "off", + "@typescript-eslint/no-parameter-properties": "off" + }, + "parserOptions": { + "sourceType": "module", + "ecmaFeatures": { + "jsx": false + } + }, + "overrides": [ + { + "files": [ + "packages/eslint-plugin-tslint/**/*.ts", + "packages/eslint-plugin-typescript/**/*.js", + "packages/typescript-eslint-parser/**/*.ts", + "packages/typescript-estree/**/*.ts" + ], + "env": { + "jest/globals": true + }, + "rules": { + "jest/no-disabled-tests": "warn", + "jest/no-focused-tests": "error", + "jest/no-identical-title": "error", + "jest/prefer-to-have-length": "warn", + "jest/valid-expect": "error" + } + }, + { + "files": ["packages/eslint-plugin-typescript/**/*.js"], + "rules": { + "eslint-plugin/fixer-return": "error", + "eslint-plugin/no-identical-tests": "error", + "eslint-plugin/no-missing-placeholders": "error", + "eslint-plugin/no-unused-placeholders": "error", + "eslint-plugin/no-useless-token-range": "error", + "eslint-plugin/require-meta-fixable": "error", + "eslint-plugin/prefer-placeholders": "error", + "eslint-plugin/prefer-replace-text": "error", + "eslint-plugin/no-deprecated-report-api": "error", + "eslint-plugin/report-message-format": ["error", "^[A-Z'{].*[\\.}]$"], + "eslint-plugin/no-deprecated-context-methods": "error", + "eslint-plugin/prefer-output-null": "error", + "eslint-plugin/test-case-shorthand-strings": "error", + "eslint-plugin/require-meta-type": "error" + } + } + ] +} diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 63512b1f85ad..87c233b7e0d7 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -21,6 +21,10 @@ jobs: yarn check-format displayName: 'Check code formatting' + - script: | + yarn lint + displayName: 'Check code formatting' + - script: | yarn test displayName: 'Run unit tests' diff --git a/package.json b/package.json index 5cb4261cb79a..ed6bbf422c9e 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,8 @@ "build": "lerna run build", "clean": "lerna clean && lerna run clean", "precommit": "yarn test && lint-staged", + "lint": "eslint . --ext .js,.ts", + "lint-fix": "eslint . --ext .js,.ts --fix", "cz": "git-cz", "commitmsg": "commitlint -E GIT_PARAMS", "check-format": "prettier --list-different \"./**/*.{ts,js,json,md}\"", @@ -63,6 +65,8 @@ "@types/semver": "^5.5.0", "cz-conventional-changelog": "2.1.0", "eslint": "^5.12.1", + "eslint-plugin-jest": "^22.1.3", + "eslint-plugin-eslint-plugin": "^2.0.1", "glob": "7.1.2", "husky": "0.14.3", "jest": "23.6.0", diff --git a/packages/typescript-estree/tests/ast-alignment/utils.ts b/packages/typescript-estree/tests/ast-alignment/utils.ts index 77336ee7b5f4..ee0a2b7d72f9 100644 --- a/packages/typescript-estree/tests/ast-alignment/utils.ts +++ b/packages/typescript-estree/tests/ast-alignment/utils.ts @@ -236,7 +236,7 @@ export function preprocessBabylonAST(ast: any): any { * Babel: ClassProperty + abstract: true * ts-estree: TSAbstractClassProperty */ - ClassProperty(node: any, parent: any) { + ClassProperty(node: any) { if (node.abstract) { node.type = 'TSAbstractClassProperty'; delete node.abstract; diff --git a/yarn.lock b/yarn.lock index c2cc9db7f6a2..a80ac0413712 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2333,6 +2333,16 @@ eslint-docs@^0.2.6: ora "^3.0.0" read-pkg-up "^4.0.0" +eslint-plugin-eslint-plugin@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-plugin/-/eslint-plugin-eslint-plugin-2.0.1.tgz#d275434969dbde3da1d4cb7a121dc8d88457c786" + integrity sha512-kJ5TZsRJH/xYstG07v3YeOy/W5SDAEzV+bvvoL0aiG1HtqDmg4mJvNPnn/JngANMmsx8oXlJrIcBTCpJzm+9kg== + +eslint-plugin-jest@^22.1.3: + version "22.1.3" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.1.3.tgz#4444108dfcddc5d2117ed6dc551f529d7e73a99e" + integrity sha512-JTZTI6WQoNruAugNyCO8fXfTONVcDd5i6dMRFA5g3rUFn1UDDLILY1bTL6alvNXbW2U7Sc2OSpi8m08pInnq0A== + eslint-scope@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.0.tgz#50bf3071e9338bcdc43331794a0cb533f0136172" From 7f24d7c548a8d329fbe9746480bccdcbd39dae8d Mon Sep 17 00:00:00 2001 From: Armano Date: Mon, 21 Jan 2019 03:06:36 +0100 Subject: [PATCH 2/8] build: attempt to fix codecov --- README.md | 2 +- azure-pipelines.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2d6dda93ecb3..bf1988cfd1db 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@

Monorepo for all the tooling which enables ESLint to support TypeScript

- Travis + Azure Pipelines GitHub license NPM Downloads Codecov diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 87c233b7e0d7..69f797f017fe 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -34,7 +34,7 @@ jobs: displayName: 'Run integrations tests' - script: | - npx codecov -t $(CODECOV_TOKEN) + npx codecov -t $CODECOV_TOKEN displayName: 'Publish code coverage report' - job: unit_tests_on_other_node_versions From d23645e3e643c82231a852a2682fb642c8ab5f7b Mon Sep 17 00:00:00 2001 From: Armano Date: Mon, 21 Jan 2019 03:19:26 +0100 Subject: [PATCH 3/8] build: attempt 2 of fixing codecov --- azure-pipelines.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 69f797f017fe..c1531eb01a0a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -34,8 +34,10 @@ jobs: displayName: 'Run integrations tests' - script: | - npx codecov -t $CODECOV_TOKEN + npx codecov displayName: 'Publish code coverage report' + env: + CODECOV_TOKEN: $(CODECOV_TOKEN) - job: unit_tests_on_other_node_versions displayName: Run unit tests on other Node.js versions From 5d67e046868e67cc6141d807e84cfb21a7314cdb Mon Sep 17 00:00:00 2001 From: Armano Date: Mon, 21 Jan 2019 03:38:29 +0100 Subject: [PATCH 4/8] build: attempt 3 of fixing codecov --- azure-pipelines.yml | 4 +--- packages/eslint-plugin-tslint/README.md | 2 +- packages/eslint-plugin/README.md | 2 +- packages/parser/README.md | 2 +- packages/typescript-estree/README.md | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c1531eb01a0a..87c233b7e0d7 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -34,10 +34,8 @@ jobs: displayName: 'Run integrations tests' - script: | - npx codecov + npx codecov -t $(CODECOV_TOKEN) displayName: 'Publish code coverage report' - env: - CODECOV_TOKEN: $(CODECOV_TOKEN) - job: unit_tests_on_other_node_versions displayName: Run unit tests on other Node.js versions diff --git a/packages/eslint-plugin-tslint/README.md b/packages/eslint-plugin-tslint/README.md index 7a1cdf297aa4..d86d911b5778 100644 --- a/packages/eslint-plugin-tslint/README.md +++ b/packages/eslint-plugin-tslint/README.md @@ -3,7 +3,7 @@

ESLint plugin wraps a TSLint configuration and lints the whole source using TSLint.

- Travis + Azure Pipelines GitHub license NPM Version NPM Downloads diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index b9366b302b31..dcc06416e664 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -1,7 +1,7 @@

ESLint Plugin TypeScript

- Travis + Azure Pipelines GitHub license NPM Version NPM Downloads diff --git a/packages/parser/README.md b/packages/parser/README.md index 77359a790f34..47124740ef5a 100644 --- a/packages/parser/README.md +++ b/packages/parser/README.md @@ -3,7 +3,7 @@

An ESLint custom parser which leverages TypeScript ESTree to allow for ESLint to lint TypeScript source code.

- Travis + Azure Pipelines GitHub license NPM Version NPM Downloads diff --git a/packages/typescript-estree/README.md b/packages/typescript-estree/README.md index 910002f4fae0..ca11d8e41301 100644 --- a/packages/typescript-estree/README.md +++ b/packages/typescript-estree/README.md @@ -3,7 +3,7 @@

A parser that converts TypeScript source code into an ESTree-compatible form

- Travis + Azure Pipelines GitHub license NPM Version NPM Downloads From 819af21f35d3a42b5c528bda4354c12c1dab7c87 Mon Sep 17 00:00:00 2001 From: Armano Date: Mon, 21 Jan 2019 04:02:09 +0100 Subject: [PATCH 5/8] docs: update azure build shield --- README.md | 3 ++- packages/eslint-plugin-tslint/README.md | 2 +- packages/eslint-plugin/README.md | 2 +- packages/parser/README.md | 2 +- packages/typescript-estree/README.md | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index bf1988cfd1db..6426c5345489 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,8 @@

Monorepo for all the tooling which enables ESLint to support TypeScript

- Azure Pipelines +undefined + Azure Pipelines GitHub license NPM Downloads Codecov diff --git a/packages/eslint-plugin-tslint/README.md b/packages/eslint-plugin-tslint/README.md index d86d911b5778..3b9f49bc0c5a 100644 --- a/packages/eslint-plugin-tslint/README.md +++ b/packages/eslint-plugin-tslint/README.md @@ -3,7 +3,7 @@

ESLint plugin wraps a TSLint configuration and lints the whole source using TSLint.

- Azure Pipelines + Azure Pipelines GitHub license NPM Version NPM Downloads diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index dcc06416e664..4b9fccac1f83 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -1,7 +1,7 @@

ESLint Plugin TypeScript

- Azure Pipelines + Azure Pipelines GitHub license NPM Version NPM Downloads diff --git a/packages/parser/README.md b/packages/parser/README.md index 47124740ef5a..fec37cab650d 100644 --- a/packages/parser/README.md +++ b/packages/parser/README.md @@ -3,7 +3,7 @@

An ESLint custom parser which leverages TypeScript ESTree to allow for ESLint to lint TypeScript source code.

- Azure Pipelines + Azure Pipelines GitHub license NPM Version NPM Downloads diff --git a/packages/typescript-estree/README.md b/packages/typescript-estree/README.md index ca11d8e41301..58a9ea4c8092 100644 --- a/packages/typescript-estree/README.md +++ b/packages/typescript-estree/README.md @@ -3,7 +3,7 @@

A parser that converts TypeScript source code into an ESTree-compatible form

- Azure Pipelines + Azure Pipelines GitHub license NPM Version NPM Downloads From 41e3791e319c3457109e963e2a1e5cd65d283cef Mon Sep 17 00:00:00 2001 From: Armano Date: Mon, 21 Jan 2019 04:03:17 +0100 Subject: [PATCH 6/8] build: correct name of step in azure pipeline --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 87c233b7e0d7..a34eaea0062d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -23,7 +23,7 @@ jobs: - script: | yarn lint - displayName: 'Check code formatting' + displayName: 'Run linting' - script: | yarn test From c75cecee693f60a3470ad8a25484df253b692814 Mon Sep 17 00:00:00 2001 From: Armano Date: Mon, 21 Jan 2019 04:11:38 +0100 Subject: [PATCH 7/8] docs: remove old badge --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 6426c5345489..061b9b9819e1 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,6 @@

Monorepo for all the tooling which enables ESLint to support TypeScript

-undefined Azure Pipelines GitHub license NPM Downloads From 1845c01481bb8e8668cfd73d906163ca3a6e34b4 Mon Sep 17 00:00:00 2001 From: Armano Date: Mon, 21 Jan 2019 04:14:33 +0100 Subject: [PATCH 8/8] docs: ensure that we are showing status from only master branch --- README.md | 2 +- packages/eslint-plugin-tslint/README.md | 2 +- packages/eslint-plugin/README.md | 2 +- packages/parser/README.md | 2 +- packages/typescript-estree/README.md | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 061b9b9819e1..de2fdd5da6ae 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@

Monorepo for all the tooling which enables ESLint to support TypeScript

- Azure Pipelines + Azure Pipelines GitHub license NPM Downloads Codecov diff --git a/packages/eslint-plugin-tslint/README.md b/packages/eslint-plugin-tslint/README.md index 3b9f49bc0c5a..7eed5033dfbb 100644 --- a/packages/eslint-plugin-tslint/README.md +++ b/packages/eslint-plugin-tslint/README.md @@ -3,7 +3,7 @@

ESLint plugin wraps a TSLint configuration and lints the whole source using TSLint.

- Azure Pipelines + Azure Pipelines GitHub license NPM Version NPM Downloads diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index 4b9fccac1f83..ec96819a455f 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -1,7 +1,7 @@

ESLint Plugin TypeScript

- Azure Pipelines + Azure Pipelines GitHub license NPM Version NPM Downloads diff --git a/packages/parser/README.md b/packages/parser/README.md index fec37cab650d..f348ae4617dc 100644 --- a/packages/parser/README.md +++ b/packages/parser/README.md @@ -3,7 +3,7 @@

An ESLint custom parser which leverages TypeScript ESTree to allow for ESLint to lint TypeScript source code.

- Azure Pipelines + Azure Pipelines GitHub license NPM Version NPM Downloads diff --git a/packages/typescript-estree/README.md b/packages/typescript-estree/README.md index 58a9ea4c8092..6769f0fca20b 100644 --- a/packages/typescript-estree/README.md +++ b/packages/typescript-estree/README.md @@ -3,7 +3,7 @@

A parser that converts TypeScript source code into an ESTree-compatible form

- Azure Pipelines + Azure Pipelines GitHub license NPM Version NPM Downloads