Skip to content

Commit

Permalink
migrate to eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagoschenkel committed May 22, 2021
1 parent 65e7b34 commit 793564f
Show file tree
Hide file tree
Showing 7 changed files with 1,749 additions and 150 deletions.
203 changes: 203 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
/*
👋 Hi! This file was autogenerated by tslint-to-eslint-config.
https://github.com/typescript-eslint/tslint-to-eslint-config
It represents the closest reasonable ESLint configuration to this
project's original TSLint configuration.
We recommend eventually switching this configuration to extend from
the recommended rulesets in typescript-eslint.
https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md
Happy linting! 💖
*/
module.exports = {
env: {
browser: true
},
extends: ["prettier"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: "tsconfig.test.json",
sourceType: "module"
},
plugins: [
"eslint-plugin-import",
"eslint-plugin-prefer-arrow",
"eslint-plugin-jsdoc",
"eslint-plugin-unicorn",
"eslint-plugin-react",
"@typescript-eslint"
],
rules: {
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/array-type": [
"error",
{
default: "array"
}
],
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/consistent-type-assertions": "off",
"@typescript-eslint/dot-notation": "error",
"@typescript-eslint/explicit-member-accessibility": [
"error",
{
accessibility: "explicit"
}
],
"@typescript-eslint/indent": "off",
"@typescript-eslint/member-delimiter-style": [
"off",
{
multiline: {
delimiter: "none",
requireLast: true
},
singleline: {
delimiter: "semi",
requireLast: false
}
}
],
"@typescript-eslint/member-ordering": "error",
"@typescript-eslint/naming-convention": "error",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-parameter-properties": "off",
"@typescript-eslint/no-shadow": [
"error",
{
hoist: "all"
}
],
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/no-unused-expressions": "error",
"@typescript-eslint/no-use-before-define": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/quotes": "off",
"@typescript-eslint/semi": ["off", null],
"@typescript-eslint/triple-slash-reference": [
"error",
{
path: "always",
types: "prefer-import",
lib: "always"
}
],
"@typescript-eslint/type-annotation-spacing": "off",
"@typescript-eslint/unified-signatures": "error",
"arrow-parens": ["off", "always"],
"brace-style": ["off", "off"],
"comma-dangle": "off",
complexity: "off",
"constructor-super": "error",
curly: "error",
"eol-last": "off",
eqeqeq: ["error", "smart"],
"guard-for-in": "error",
"id-blacklist": "off",
"id-match": "off",
"import/no-extraneous-dependencies": "error",
"import/no-internal-modules": "error",
"import/order": "off",
"jsdoc/check-alignment": "error",
"jsdoc/check-indentation": "error",
"jsdoc/newline-after-description": "error",
"linebreak-style": "off",
"max-classes-per-file": ["error", 1],
"max-len": "off",
"new-parens": "off",
"newline-per-chained-call": "off",
"no-bitwise": "error",
"no-caller": "error",
"no-cond-assign": "error",
"no-console": [
"error",
{
allow: [
"log",
"warn",
"dir",
"timeLog",
"assert",
"clear",
"count",
"countReset",
"group",
"groupEnd",
"table",
"dirxml",
"error",
"groupCollapsed",
"Console",
"profile",
"profileEnd",
"timeStamp",
"context"
]
}
],
"no-debugger": "error",
"no-duplicate-case": "error",
"no-duplicate-imports": "error",
"no-empty": "off",
"no-eval": "error",
"no-extra-bind": "error",
"no-extra-semi": "off",
"no-fallthrough": "off",
"no-invalid-this": "off",
"no-irregular-whitespace": "off",
"no-multiple-empty-lines": "off",
"no-new-func": "error",
"no-new-wrappers": "error",
"no-redeclare": "error",
"no-return-await": "error",
"no-sequences": "error",
"no-sparse-arrays": "error",
"no-template-curly-in-string": "error",
"no-throw-literal": "error",
"no-trailing-spaces": "off",
"no-undef-init": "error",
"no-underscore-dangle": "off",
"no-unsafe-finally": "error",
"no-unused-labels": "error",
"no-var": "error",
"object-shorthand": "error",
"one-var": ["error", "never"],
"prefer-arrow/prefer-arrow-functions": "off",
"prefer-const": "off",
"prefer-object-spread": "error",
"quote-props": "off",
radix: "error",
"react/jsx-curly-spacing": "off",
"react/jsx-equals-spacing": "off",
"react/jsx-tag-spacing": [
"off",
{
afterOpening: "allow",
closingSlash: "allow"
}
],
"react/jsx-wrap-multilines": "off",
"space-before-function-paren": "off",
"space-in-parens": ["off", "never"],
"spaced-comment": [
"error",
"always",
{
markers: ["/"]
}
],
"unicorn/prefer-ternary": "error",
"use-isnan": "error",
"valid-typeof": "off"
}
};
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["dbaeumer.vscode-eslint"]
}
9 changes: 5 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
// Place your settings in this file to overwrite default and user settings.
{
"typescript.tsdk": "node_modules/typescript/lib",
"tslint.configFile": "tslint.test.json",

// Set the default
"editor.defaultFormatter": null,
"editor.formatOnSave": false,

// Enable per-language
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},

"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},

"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},

"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
}
26 changes: 17 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"scripts": {
"test": "nyc mocha",
"karma": "node --max-old-space-size=2048 node_modules/.bin/karma start --single-run",
"tslint-check:src": "tslint-config-prettier-check ./tslint.json",
"tslint-check:test": "tslint-config-prettier-check ./tslint.test.json",
"tslint:src": "tslint --project tsconfig.json",
"tslint:test": "tslint --config tslint.test.json --project tsconfig.test.json",
"tslint": "npm run tslint-check:src && npm run tslint-check:test && npm run tslint:src && npm run tslint:test",
"lint-fix:src": "eslint -c .eslintrc.js --ext .ts ./src --fix",
"lint-fix:test": "eslint -c .eslintrc.js --ext .ts ./test --fix",
"lint:src": "eslint -c .eslintrc.js --ext .ts ./src",
"lint:test": "eslint -c .eslintrc.js --ext .ts ./test",
"lint": "npm run lint:src && npm run lint:test",
"autoformat": "prettier --config .prettierrc --write --list-different \"{src,static,test,example,definitions}/{**,**/**}.{html,css,js,json,ts}\"",
"clean-up": "rimraf .nyc_output && rimraf coverage && rimraf lib && rimraf lib-test && rimraf dist-test",
"compile:src": "tsc -d --importHelpers",
Expand All @@ -20,7 +20,7 @@
"build": "webpack --env.production",
"prepare": "npm run clean-up && npm run compile:src",
"prepublishOnly": "publish-please guard",
"publish-please": "npm run tslint && npm run autoformat && npm run clean-up && npm run build && npm run test && publish-please"
"publish-please": "npm run lint && npm run autoformat && npm run clean-up && npm run build && npm run test && publish-please"
},
"nyc": {
"extends": "@istanbuljs/nyc-config-typescript",
Expand Down Expand Up @@ -81,11 +81,21 @@
"@types/mocha": "^8.2.0",
"@types/sinon": "^9.0.9",
"@types/webpack-env": "^1.16.0",
"@typescript-eslint/eslint-plugin": "^4.24.0",
"@typescript-eslint/eslint-plugin-tslint": "^4.24.0",
"@typescript-eslint/parser": "^4.24.0",
"bluebird": "^3.7.2",
"browserify-versionify": "^1.0.6",
"chai": "^4.2.0",
"es6-map": "^0.1.5",
"es6-symbol": "^3.1.3",
"eslint": "^7.27.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.23.3",
"eslint-plugin-jsdoc": "^34.8.2",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-react": "^7.23.2",
"eslint-plugin-unicorn": "^32.0.1",
"glslify": "^7.1.1",
"imports-loader": "^0.8.0",
"istanbul-instrumenter-loader": "^3.0.1",
Expand Down Expand Up @@ -113,11 +123,9 @@
"terser-webpack-plugin": "^2.3.5",
"ts-loader": "^8.0.12",
"ts-node": "^9.1.1",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0",
"typescript": "^4.1.3",
"webpack": "^4.44.2",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0"
}
}
}
67 changes: 0 additions & 67 deletions tslint.json

This file was deleted.

8 changes: 0 additions & 8 deletions tslint.test.json

This file was deleted.

Loading

0 comments on commit 793564f

Please sign in to comment.