From b552b6ae6487ce5cf460d77de2f58575e2ec89ab Mon Sep 17 00:00:00 2001 From: Jake Jarvis Date: Mon, 10 Jan 2022 13:46:49 -0500 Subject: [PATCH] add typescript eslint parser/rules --- .eslintrc.js | 12 +++++- components/clipboard/CopyButton.tsx | 1 + package.json | 2 + pages/index.tsx | 2 +- yarn.lock | 58 ++++++++++++++++++++++++++++- 5 files changed, 70 insertions(+), 5 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index a79b229c..8b11362d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,8 +1,16 @@ module.exports = { root: true, - extends: ["@jakejarvis/eslint-config", "next/core-web-vitals", "plugin:prettier/recommended"], - plugins: ["prettier"], + parser: "@typescript-eslint/parser", + extends: [ + "@jakejarvis/eslint-config", + "next/core-web-vitals", + "plugin:@typescript-eslint/recommended", + "plugin:prettier/recommended", + ], + plugins: ["@typescript-eslint", "prettier"], rules: { "react/no-unescaped-entities": "off", + "@typescript-eslint/ban-ts-comment": "off", + "@typescript-eslint/no-explicit-any": "off", }, }; diff --git a/components/clipboard/CopyButton.tsx b/components/clipboard/CopyButton.tsx index ab9e0bce..8b8edb4c 100644 --- a/components/clipboard/CopyButton.tsx +++ b/components/clipboard/CopyButton.tsx @@ -38,6 +38,7 @@ const CopyButton = ({ source, timeout = 2000 }: Props) => { return () => clearTimeout(id); } + // eslint-disable-next-line @typescript-eslint/no-empty-function return () => {}; }, [timeout, copied]); diff --git a/package.json b/package.json index d55ba5c4..b042af15 100644 --- a/package.json +++ b/package.json @@ -81,6 +81,8 @@ "@types/react-dom": "^17.0.11", "@types/react-is": "^17.0.3", "@types/sanitize-html": "^2.6.1", + "@typescript-eslint/eslint-plugin": "^5.9.1", + "@typescript-eslint/parser": "^5.9.1", "autoprefixer": "^10.4.2", "cross-env": "^7.0.3", "esbuild": "^0.14.11", diff --git a/pages/index.tsx b/pages/index.tsx index ec30f4a4..0c681b7f 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -16,7 +16,7 @@ const ColorLink = ({ href, title, lightColor, darkColor, external = false, child external = external || isAbsoluteUrl(href); // spits out a translucent color in rgba() format that's compatible with linear-gradient() - const hexToRgba = (hex: string, alpha: number = 0.4) => hexRgb(hex, { alpha, format: "css" }); + const hexToRgba = (hex: string, alpha = 0.4) => hexRgb(hex, { alpha, format: "css" }); return ( diff --git a/yarn.lock b/yarn.lock index 4edac6be..bacc784e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1484,6 +1484,11 @@ resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz#0ea7b61496902b95890dc4c3a116b60cb8dae812" integrity sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ== +"@types/json-schema@^7.0.9": + version "7.0.9" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.9.tgz#97edc9037ea0c38585320b28964dde3b39e4660d" + integrity sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ== + "@types/json5@^0.0.29": version "0.0.29" resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" @@ -1605,7 +1610,34 @@ resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.6.tgz#250a7b16c3b91f672a24552ec64678eeb1d3a08d" integrity sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ== -"@typescript-eslint/parser@^5.0.0": +"@typescript-eslint/eslint-plugin@^5.9.1": + version "5.9.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.9.1.tgz#e5a86d7e1f9dc0b3df1e6d94feaf20dd838d066c" + integrity sha512-Xv9tkFlyD4MQGpJgTo6wqDqGvHIRmRgah/2Sjz1PUnJTawjHWIwBivUE9x0QtU2WVii9baYgavo/bHjrZJkqTw== + dependencies: + "@typescript-eslint/experimental-utils" "5.9.1" + "@typescript-eslint/scope-manager" "5.9.1" + "@typescript-eslint/type-utils" "5.9.1" + debug "^4.3.2" + functional-red-black-tree "^1.0.1" + ignore "^5.1.8" + regexpp "^3.2.0" + semver "^7.3.5" + tsutils "^3.21.0" + +"@typescript-eslint/experimental-utils@5.9.1": + version "5.9.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-5.9.1.tgz#8c407c4dd5ffe522329df6e4c9c2b52206d5f7f1" + integrity sha512-cb1Njyss0mLL9kLXgS/eEY53SZQ9sT519wpX3i+U457l2UXRDuo87hgKfgRazmu9/tQb0x2sr3Y0yrU+Zz0y+w== + dependencies: + "@types/json-schema" "^7.0.9" + "@typescript-eslint/scope-manager" "5.9.1" + "@typescript-eslint/types" "5.9.1" + "@typescript-eslint/typescript-estree" "5.9.1" + eslint-scope "^5.1.1" + eslint-utils "^3.0.0" + +"@typescript-eslint/parser@^5.0.0", "@typescript-eslint/parser@^5.9.1": version "5.9.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.9.1.tgz#b114011010a87e17b3265ca715e16c76a9834cef" integrity sha512-PLYO0AmwD6s6n0ZQB5kqPgfvh73p0+VqopQQLuNfi7Lm0EpfKyDalchpVwkE+81k5HeiRrTV/9w1aNHzjD7C4g== @@ -1623,6 +1655,15 @@ "@typescript-eslint/types" "5.9.1" "@typescript-eslint/visitor-keys" "5.9.1" +"@typescript-eslint/type-utils@5.9.1": + version "5.9.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.9.1.tgz#c6832ffe655b9b1fec642d36db1a262d721193de" + integrity sha512-tRSpdBnPRssjlUh35rE9ug5HrUvaB9ntREy7gPXXKwmIx61TNN7+l5YKgi1hMKxo5NvqZCfYhA5FvyuJG6X6vg== + dependencies: + "@typescript-eslint/experimental-utils" "5.9.1" + debug "^4.3.2" + tsutils "^3.21.0" + "@typescript-eslint/types@5.9.1": version "5.9.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.9.1.tgz#1bef8f238a2fb32ebc6ff6d75020d9f47a1593c6" @@ -2826,6 +2867,14 @@ eslint-plugin-react@^7.27.0: semver "^6.3.0" string.prototype.matchall "^4.0.6" +eslint-scope@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" + integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== + dependencies: + esrecurse "^4.3.0" + estraverse "^4.1.1" + eslint-scope@^7.1.0: version "7.1.0" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.1.0.tgz#c1f6ea30ac583031f203d65c73e723b01298f153" @@ -2923,6 +2972,11 @@ esrecurse@^4.3.0: dependencies: estraverse "^5.2.0" +estraverse@^4.1.1: + version "4.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" + integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== + estraverse@^5.1.0, estraverse@^5.2.0, estraverse@^5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" @@ -3556,7 +3610,7 @@ ignore@^4.0.6: resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== -ignore@^5.2.0: +ignore@^5.1.8, ignore@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a" integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==