Skip to content
This repository has been archived by the owner on Aug 1, 2022. It is now read-only.

Commit

Permalink
fix(ci): improved svelte/typescript linting
Browse files Browse the repository at this point in the history
* We drop the patched v3.0.0 of `eslint-plugin-svelte3` in favor of
  built-in TypeScript support in [v3.1.0][]
* To make the TypeScript linting work we extend the ESLint configuration
  with the recommended rules from `@typescript-eslint/eslint-plugin`.
* In turn, the recommended rules require us to make some adjustments to
  files and rules.

[v3.1.0]: https://github.com/sveltejs/eslint-plugin-svelte3/blob/master/CHANGELOG.md#310

Signed-off-by: Thomas Scholtes <thomas@monadic.xyz>
  • Loading branch information
Thomas Scholtes committed May 7, 2021
1 parent 7216e34 commit 535abce
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 441 deletions.
15 changes: 9 additions & 6 deletions .eslintrc.js
@@ -1,6 +1,3 @@
const eslintSveltePreprocess = require("eslint-svelte3-preprocess");
const svelteConfig = require("./svelte.config");

module.exports = {
env: {
node: true,
Expand All @@ -13,7 +10,7 @@ module.exports = {
ecmaVersion: 2019,
sourceType: "module",
},
extends: ["eslint:recommended"],
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
plugins: ["svelte3", "@typescript-eslint", "no-only-tests"],
overrides: [
{
Expand Down Expand Up @@ -43,7 +40,6 @@ module.exports = {
rules: {
// Disallow Unused Variables
// https://eslint.org/docs/rules/no-unused-vars
"no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
// require using arrow functions as callbacks
// https://eslint.org/docs/rules/prefer-arrow-callback
Expand All @@ -65,8 +61,15 @@ module.exports = {
"spaced-comment": ["warn", "always"],
// Disallow focused tests
"no-only-tests/no-only-tests": "error",

// We are ok with providing explict type annotations for additional
// clarity.
"@typescript-eslint/no-inferrable-types": "off",
// We are ok with empty functions. Often we need a no-op function
// as an argument.
"@typescript-eslint/no-empty-function": "off",
},
settings: {
"svelte3/preprocess": eslintSveltePreprocess(svelteConfig.preprocess),
"svelte3/typescript": true,
},
};
1 change: 1 addition & 0 deletions builder/notarize.js
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const { notarize } = require("electron-notarize");
const appId = require("../package.json").build.appId;

Expand Down
1 change: 1 addition & 0 deletions native/index.js
@@ -1,2 +1,3 @@
/* eslint-disable @typescript-eslint/no-var-requires */
require("ts-node").register();
require("./index.ts");
1 change: 1 addition & 0 deletions native/preload.js
@@ -1,3 +1,4 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { ipcRenderer, contextBridge } = require("electron");

contextBridge.exposeInMainWorld("electron", {
Expand Down
3 changes: 1 addition & 2 deletions package.json
Expand Up @@ -99,8 +99,7 @@
"eslint": "^7.25.0",
"eslint-plugin-cypress": "^2.11.2",
"eslint-plugin-no-only-tests": "^2.5.0",
"eslint-plugin-svelte3": "=3.0.0",
"eslint-svelte3-preprocess": "=0.0.4",
"eslint-plugin-svelte3": "^3.2.0",
"exit-hook": "^2.2.1",
"ganache-cli": "^6.12.2",
"html-webpack-plugin": "^5.3.1",
Expand Down

0 comments on commit 535abce

Please sign in to comment.