-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.js
81 lines (79 loc) · 2.75 KB
/
.eslintrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Copyright © 2022 The Radicle Design System Contributors
//
// This file is part of radicle-design-system, distributed under the GPLv3
// with Radicle Linking Exception. For full terms see the included
// LICENSE file.
module.exports = {
env: {
node: true,
browser: true,
es6: true,
},
parser: "@typescript-eslint/parser",
parserOptions: {
createDefaultProgram: true,
ecmaVersion: 2019,
sourceType: "module",
},
ignorePatterns: ["!.license-compliancerc.js"],
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
plugins: ["svelte3", "@typescript-eslint"],
overrides: [
{
files: ["*.svelte"],
processor: "svelte3/svelte3",
},
{
files: ["scripts/*.ts"],
rules: {
// Script files are not bundled so we can’t use module imports.
"@typescript-eslint/no-var-requires": "off",
},
},
{
files: ["*.js", "*.mjs"],
rules: {
"@typescript-eslint/explicit-module-boundary-types": "off",
},
},
],
rules: {
// Disallow Unused Variables
// https://eslint.org/docs/rules/no-unused-vars
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
// require using arrow functions as callbacks
// https://eslint.org/docs/rules/prefer-arrow-callback
"prefer-arrow-callback": "error",
// require using template literals instead of string concatenation
// http://eslint.org/docs/rules/prefer-template
"prefer-template": "error",
// require using of const declaration for variables that are never modified after declared
// https://eslint.org/docs/rules/prefer-const
"prefer-const": "error",
// disallow modifying variables that are declared using const
// https://eslint.org/docs/rules/no-const-assign
"no-const-assign": "error",
// require let or const instead of var
// https://eslint.org/docs/rules/no-var
"no-var": "error",
// require at least one whitespace after comments( // and /*)
// https://eslint.org/docs/rules/spaced-comment
"spaced-comment": ["warn", "always"],
// Require `===` and `!==` comparisons
eqeqeq: "error",
// Enforce curly braces for if/else statements for better clarity.
curly: "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",
"@typescript-eslint/no-implicit-any-catch": "error",
"@typescript-eslint/explicit-member-accessibility": "error",
"@typescript-eslint/explicit-module-boundary-types": "error",
},
settings: {
"svelte3/typescript": true,
},
};