Skip to content

build(lint): migrate from tslint to eslint #160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
packages/*/node_modules
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./packages/lint/.eslintrc"
}
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"commitlint": "commitlint",
"start": "lerna run --parallel watch",
"start:storybook": "cd packages/react-kit && yarn start",
"test": "yarn tslint && yarn jest",
"test": "yarn eslint && yarn jest",
"lerna": "lerna",
"lerna:bootstrap": "yarn lerna -- bootstrap",
"lerna:update": "yarn lerna -- clean && yarn lerna -- bootstrap",
Expand All @@ -16,10 +16,12 @@
"jest": "jest",
"prettier": "prettier --list-different \"./packages/**/src/**/*.{ts,tsx}\"",
"prettier:fix": "prettier --write \"./packages/**/src/**/*.{ts,tsx}\"",
"tslint": "tslint -c tslint.json --project tsconfig.json './packages/*/src/**/*.ts' './packages/*/src/**/*.tsx'",
"publish:patch": "yarn lerna publish patch --force-publish=*",
"publish:minor": "yarn lerna publish minor --force-publish=*",
"publish:major": "yarn lerna publish major --force-publish=*"
"publish:major": "yarn lerna publish major --force-publish=*",
"eslint": "eslint ./packages/*/src/**/*.{ts,tsx}",
"eslint:fix": "eslint --fix ./packages/*/src/**/*.{ts,tsx}",
"eslint:config": "eslint --print-config ./packages/*/src/**/*.{ts,tsx}"
},
"private": true,
"workspaces": [
Expand Down Expand Up @@ -70,12 +72,12 @@
"@commitlint/config-conventional": "^8.1.0",
"@commitlint/travis-cli": "^8.1.0",
"@types/jest": "^24.0.11",
"eslint": "^6.3.0",
"husky": "^3.0.5",
"jest": "^24.7.1",
"lerna": "^3.10.5",
"prettier": "^1.18.2",
"ts-jest": "^24.0.2",
"tslint": "^5.19.0"
"ts-jest": "^24.0.2"
},
"husky": {
"hooks": {
Expand Down
112 changes: 112 additions & 0 deletions packages/lint/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"env": {
"browser": true,
"es6": true,
"jest": true,
"node": true
},
"plugins": ["prettier", "@typescript-eslint", "jsdoc"],
"rules": {
"prettier/prettier": "error",
"@typescript-eslint/adjacent-overload-signatures": "off",
"@typescript-eslint/array-type": "off",
"@typescript-eslint/class-name-casing": "error",
"@typescript-eslint/consistent-type-definitions": "off",
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/indent": "off",
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/member-delimiter-style": [
"error",
{
"multiline": { "delimiter": "semi", "requireLast": true },
"singleline": { "delimiter": "semi", "requireLast": false }
}
],
"@typescript-eslint/member-ordering": "off",
"@typescript-eslint/consistent-type-assertions": ["error", { "assertionStyle": "as" }],
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-for-in-array": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-magic-numbers": "off",
"@typescript-eslint/no-namespace": ["error", { "allowDeclarations": true }],
"@typescript-eslint/no-parameter-properties": "off",
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/triple-slash-reference": ["error", { "path": "never" }],
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/prefer-function-type": "off",
"@typescript-eslint/prefer-interface": "off",
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/promise-function-async": "off",
"@typescript-eslint/restrict-plus-operands": "off",
"@typescript-eslint/semi": "error",
"@typescript-eslint/strict-boolean-expressions": "off",
"@typescript-eslint/typedef": [
"error",
{ "propertyDeclaration": true, "arrowParameter": false, "memberVariableDeclaration": false, "parameter": false }
],
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unified-signatures": "error",
"jsdoc/check-alignment": "error",
"arrow-parens": ["error", "as-needed"],
"spaced-comment": "off",
"capitalized-comments": "off",
"comma-dangle": "off",
"complexity": "off",
"curly": "error",
"default-case": "off",
"dot-notation": "off",
"eol-last": "off",
"eqeqeq": "error",
"guard-for-in": "error",
"indent": "off",
"linebreak-style": "off",
"max-classes-per-file": "off",
"max-lines": "off",
"new-parens": "error",
"newline-per-chained-call": "off",
"no-bitwise": "error",
"no-caller": "error",
"no-cond-assign": "error",
"no-debugger": "error",
"no-duplicate-case": "error",
"no-empty": "off",
"no-empty-functions": "off",
"no-eval": "error",
"no-extra-semi": "off",
"no-fallthrough": "off",
"no-invalid-this": "off",
"no-irregular-whitespace": "off",
"no-magic-numbers": "off",
"no-multiple-empty-lines": "error",
"no-new-wrappers": "error",
"no-redeclare": "error",
"no-shadow": "off",
"no-throw-literal": "error",
"no-trailing-spaces": "error",
"no-unsafe-finally": "error",
"no-unused-expressions": ["error", { "allowShortCircuit": true, "allowTernary": true }],
"no-unused-labels": "off",
"no-var": "error",
"no-void": "off",
"object-shorthand": "error",
"one-var": ["error", "never"],
"prefer-const": "error",
"quote-props": ["error", "as-needed"],
"quotes": ["error", "single", { "allowTemplateLiterals": true, "avoidEscape": true }],
"radix": "error",
"semi": ["error", "always"],
"space-before-function-paren": "off",
"sort-keys": "off",
"use-isnan": "error"
}
}
2 changes: 1 addition & 1 deletion packages/lint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
## @devexperts/lint
Infrastructure configuration files, to have consistent linting rules across different Devexperts frontend team projects. Those files are:

* `tslint.json`
* `.eslintrc.js`
* `.prettierrc.json`
* `tsconfig.json`? - _I'm not even sure that we need to have this file here, it's more like part of `@devexperts/tools`_
17 changes: 7 additions & 10 deletions packages/lint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@
"main": "dist",
"module": "dist",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "dx-tools build-lib src dist --failOnError",
"clean": "dx-tools clean dist",
"prepare": "yarn clean && yarn build",
"start": "yarn watch",
"watch": "dx-tools build-lib src dist -w"
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
Expand All @@ -27,17 +22,19 @@
"homepage": "https://github.com/devexperts/dx-platform#readme",
"dependencies": {
"@types/node": "^8.10.19",
"tslint-config-prettier": "^1.18.0",
"tslint-plugin-prettier": "^2.0.1",
"@typescript-eslint/eslint-plugin": "^2.0.0",
"@typescript-eslint/parser": "^2.0.0",
"eslint-config-prettier": "^6.1.0",
"eslint-plugin-jsdoc": "^15.8.3",
"eslint-plugin-prettier": "^3.1.0",
"tsutils": "^3.17.1"
},
"peerDependencies": {
"tslint": "^5.10.0",
"typescript": "^3.2.2"
},
"devDependencies": {
"@devexperts/tools": "^1.0.0-alpha.1",
"tslint": "^5.19.0",
"eslint": "^6.3.0",
"typescript": "^3.5.3"
}
}
46 changes: 0 additions & 46 deletions packages/lint/src/disallowImportsRule.ts

This file was deleted.

Loading