Skip to content

Commit

Permalink
chore: improve eslint config
Browse files Browse the repository at this point in the history
  • Loading branch information
kantord committed Apr 10, 2021
1 parent dbd5dee commit c50ed2b
Show file tree
Hide file tree
Showing 13 changed files with 93 additions and 7 deletions.
11 changes: 9 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
parser: "@typescript-eslint/parser",
ignorePatterns: ["node_modules/"],
env: {
browser: true,
Expand All @@ -7,7 +8,10 @@ module.exports = {
"jest/globals": true,
"cypress/globals": true,
},
extends: ["eslint:recommended"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
],
globals: {
Atomics: "readonly",
SharedArrayBuffer: "readonly",
Expand All @@ -16,8 +20,9 @@ module.exports = {
parserOptions: {
ecmaVersion: 2020,
sourceType: "module",
extraFileExtensions: [".svelte"]
},
plugins: ["svelte3", "jest", "cypress"],
plugins: ["svelte3", "jest", "cypress", '@typescript-eslint'],
overrides: [
{
files: ["**/*.svelte"],
Expand All @@ -31,13 +36,15 @@ module.exports = {
},
],
rules: {
"@typescript-eslint/no-unused-vars": "error",
indent: ["error", 4],
"linebreak-style": ["error", "unix"],
quotes: ["error", "double"],
semi: ["error", "never"],
},
settings: {
"svelte3/ignore-styles": () => true,
"svelte3/typescript": require("typescript"),
},
}

1 change: 1 addition & 0 deletions apps/web/cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/ChallengeScreen.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import shuffle from "lodash.shuffle"
import { fade, scale } from "svelte/transition"
// TODO: deal with this ignore comment
// eslint-disable-next-line no-unused-vars
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import db from "../db/db"

export let rawChallenges
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/components/GitHubButton.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import { onMount } from "svelte"
import Icon from "lluis/Icon"
import Button from "lluis/Button"
// eslint-disable-next-line @typescript-eslint/no-var-requires
const pMemoize = require("p-memoize")
export let stars = (process.browser === true ? window.stars : null) || " "
export let size = "small"
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/components/SkillCard/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
started = stats.started
stale = stats.stale && completed
})
// eslint-disable-next-line @typescript-eslint/no-empty-function
.catch(() => {})
)
})
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/db/db.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
import settings from "../settings"
import getUserDbName from "./getUserDbName"
import Cookies from "js-cookie"
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/db/live.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import db from "./db"
export default (listener) => {
listener(db)
if (process.browser === true && process.env.JEST_WORKER_ID === undefined) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const authStore = require("../auth").default
authStore.subscribe(() => listener(db))
}
Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/routes/devtools.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<script lang="typescript" context="module">
export async function preload() {
if (!process.browser) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const fs = require("fs")
// eslint-disable-next-line @typescript-eslint/no-var-requires
const util = require("util")
const readdir = util.promisify(fs.readdir)

Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/routes/login.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="typescript">
// TODO: deal with this ignore comment
// eslint-disable-next-line no-unused-vars
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import db from "../db/db.js"
import NavBar from "../components/NavBar.svelte"
import Button from "lluis/Button"
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/routes/sign-up-success.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="typescript">
// TODO: deal with this ignore comment
// eslint-disable-next-line no-unused-vars
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import db from "../db/db.js"
import NavBar from "../components/NavBar.svelte"
import Button from "lluis/Button"
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/routes/sign-up.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="typescript">
// TODO: deal with this ignore comment
// eslint-disable-next-line no-unused-vars
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import db from "../db/db.js"
import settings from "../settings"
import NavBar from "../components/NavBar.svelte"
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
]
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.21.0",
"@typescript-eslint/parser": "^4.21.0",
"eslint": "7.24.0",
"eslint-plugin-cypress": "2.11.2",
"eslint-plugin-jest": "24.3.4",
Expand Down
72 changes: 71 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2639,6 +2639,32 @@
dependencies:
"@types/node" "*"

"@typescript-eslint/eslint-plugin@^4.21.0":
version "4.21.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.21.0.tgz#3fce2bfa76d95c00ac4f33dff369cb593aab8878"
integrity sha512-FPUyCPKZbVGexmbCFI3EQHzCZdy2/5f+jv6k2EDljGdXSRc0cKvbndd2nHZkSLqCNOPk0jB6lGzwIkglXcYVsQ==
dependencies:
"@typescript-eslint/experimental-utils" "4.21.0"
"@typescript-eslint/scope-manager" "4.21.0"
debug "^4.1.1"
functional-red-black-tree "^1.0.1"
lodash "^4.17.15"
regexpp "^3.0.0"
semver "^7.3.2"
tsutils "^3.17.1"

"@typescript-eslint/experimental-utils@4.21.0":
version "4.21.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.21.0.tgz#0b0bb7c15d379140a660c003bdbafa71ae9134b6"
integrity sha512-cEbgosW/tUFvKmkg3cU7LBoZhvUs+ZPVM9alb25XvR0dal4qHL3SiUqHNrzoWSxaXA9gsifrYrS1xdDV6w/gIA==
dependencies:
"@types/json-schema" "^7.0.3"
"@typescript-eslint/scope-manager" "4.21.0"
"@typescript-eslint/types" "4.21.0"
"@typescript-eslint/typescript-estree" "4.21.0"
eslint-scope "^5.0.0"
eslint-utils "^2.0.0"

"@typescript-eslint/experimental-utils@^4.0.1":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.0.1.tgz#7d9a3ab6821ad5274dad2186c1aa0d93afd696eb"
Expand All @@ -2651,6 +2677,16 @@
eslint-scope "^5.0.0"
eslint-utils "^2.0.0"

"@typescript-eslint/parser@^4.21.0":
version "4.21.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.21.0.tgz#a227fc2af4001668c3e3f7415d4feee5093894c1"
integrity sha512-eyNf7QmE5O/l1smaQgN0Lj2M/1jOuNg2NrBm1dqqQN0sVngTLyw8tdCbih96ixlhbF1oINoN8fDCyEH9SjLeIA==
dependencies:
"@typescript-eslint/scope-manager" "4.21.0"
"@typescript-eslint/types" "4.21.0"
"@typescript-eslint/typescript-estree" "4.21.0"
debug "^4.1.1"

"@typescript-eslint/scope-manager@4.0.1":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.0.1.tgz#24d93c3000bdfcc5a157dc4d32b742405a8631b5"
Expand All @@ -2659,11 +2695,24 @@
"@typescript-eslint/types" "4.0.1"
"@typescript-eslint/visitor-keys" "4.0.1"

"@typescript-eslint/scope-manager@4.21.0":
version "4.21.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.21.0.tgz#c81b661c4b8af1ec0c010d847a8f9ab76ab95b4d"
integrity sha512-kfOjF0w1Ix7+a5T1knOw00f7uAP9Gx44+OEsNQi0PvvTPLYeXJlsCJ4tYnDj5PQEYfpcgOH5yBlw7K+UEI9Agw==
dependencies:
"@typescript-eslint/types" "4.21.0"
"@typescript-eslint/visitor-keys" "4.21.0"

"@typescript-eslint/types@4.0.1":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.0.1.tgz#1cf72582f764931f085cb8230ff215980fe467b2"
integrity sha512-S+gD3fgbkZYW2rnbjugNMqibm9HpEjqZBZkTiI3PwbbNGWmAcxolWIUwZ0SKeG4Dy2ktpKKaI/6+HGYVH8Qrlg==

"@typescript-eslint/types@4.21.0":
version "4.21.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.21.0.tgz#abdc3463bda5d31156984fa5bc316789c960edef"
integrity sha512-+OQaupjGVVc8iXbt6M1oZMwyKQNehAfLYJJ3SdvnofK2qcjfor9pEM62rVjBknhowTkh+2HF+/KdRAc/wGBN2w==

"@typescript-eslint/typescript-estree@4.0.1":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.0.1.tgz#29a43c7060641ec51c902d9f50ac7c5866ec479f"
Expand All @@ -2678,6 +2727,19 @@
semver "^7.3.2"
tsutils "^3.17.1"

"@typescript-eslint/typescript-estree@4.21.0":
version "4.21.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.21.0.tgz#3817bd91857beeaeff90f69f1f112ea58d350b0a"
integrity sha512-ZD3M7yLaVGVYLw4nkkoGKumb7Rog7QID9YOWobFDMQKNl+vPxqVIW/uDk+MDeGc+OHcoG2nJ2HphwiPNajKw3w==
dependencies:
"@typescript-eslint/types" "4.21.0"
"@typescript-eslint/visitor-keys" "4.21.0"
debug "^4.1.1"
globby "^11.0.1"
is-glob "^4.0.1"
semver "^7.3.2"
tsutils "^3.17.1"

"@typescript-eslint/visitor-keys@4.0.1":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.0.1.tgz#d4e8de62775f2a6db71c7e8539633680039fdd6c"
Expand All @@ -2686,6 +2748,14 @@
"@typescript-eslint/types" "4.0.1"
eslint-visitor-keys "^2.0.0"

"@typescript-eslint/visitor-keys@4.21.0":
version "4.21.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.21.0.tgz#990a9acdc124331f5863c2cf21c88ba65233cd8d"
integrity sha512-dH22dROWGi5Z6p+Igc8bLVLmwy7vEe8r+8c+raPQU0LxgogPUrRAtRGtvBWmlr9waTu3n+QLt/qrS/hWzk1x5w==
dependencies:
"@typescript-eslint/types" "4.21.0"
eslint-visitor-keys "^2.0.0"

"@webassemblyjs/ast@1.9.0":
version "1.9.0"
resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.9.0.tgz#bd850604b4042459a5a41cd7d338cbed695ed964"
Expand Down Expand Up @@ -12313,7 +12383,7 @@ regexparam@^1.3.0:
resolved "https://registry.yarnpkg.com/regexparam/-/regexparam-1.3.0.tgz#2fe42c93e32a40eff6235d635e0ffa344b92965f"
integrity sha512-6IQpFBv6e5vz1QAqI+V4k8P2e/3gRrqfCJ9FI+O1FLQTO+Uz6RXZEZOPmTJ6hlGj7gkERzY5BRCv09whKP96/g==

regexpp@^3.1.0:
regexpp@^3.0.0, regexpp@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.1.0.tgz#206d0ad0a5648cffbdb8ae46438f3dc51c9f78e2"
integrity sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==
Expand Down

1 comment on commit c50ed2b

@vercel
Copy link

@vercel vercel bot commented on c50ed2b Apr 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.