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/README.md b/README.md index 2d6dda93ecb3..de2fdd5da6ae 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@
Monorepo for all the tooling which enables ESLint to support TypeScript
-
+
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 63512b1f85ad..a34eaea0062d 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: 'Run linting'
+
- 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/eslint-plugin-tslint/README.md b/packages/eslint-plugin-tslint/README.md
index 7a1cdf297aa4..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.
-
+
diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md
index b9366b302b31..ec96819a455f 100644
--- a/packages/eslint-plugin/README.md
+++ b/packages/eslint-plugin/README.md
@@ -1,7 +1,7 @@
-
+
diff --git a/packages/parser/README.md b/packages/parser/README.md
index 77359a790f34..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.
-
+
diff --git a/packages/typescript-estree/README.md b/packages/typescript-estree/README.md
index 910002f4fae0..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
-
+
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"