This repository has been archived by the owner on Jul 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
.eslintrc.js
124 lines (123 loc) · 3.6 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
module.exports = {
env: { browser: true, es2020: true },
extends: [
"eslint:recommended",
"plugin:jsdoc/recommended",
"google",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier",
],
ignorePatterns: [
"dist/",
// This configuration is designed for TypeScript and much of it doesn't
// work properly with .js files.
".eslintrc.js",
"fake_server.js",
"karma.conf.js",
"webpack.config.js",
],
parser: "@typescript-eslint/parser",
parserOptions: {
sourceType: "module",
tsconfigRootDir: __dirname,
project: ["./tsconfig.json"],
},
plugins: ["@typescript-eslint", "jsdoc"],
rules: {
"max-len": [
"warn",
{
// Whatever Prettier wraps lines to is acceptable.
code: Infinity,
// However, Prettier doesn't wrap comments.
comments: 80,
ignorePattern: String.raw`^\s*// eslint-disable-next-line.*`,
ignoreUrls: true,
},
],
// Per https://eslint.org/docs/rules/no-inner-declarations, this is obsolete
// since ES2015.
"no-inner-declarations": "off",
// Superseded by jsdoc/require-jsdoc.
"require-jsdoc": "off",
// Many JSDoc-related rules are superseded by TypeScript type annotation
// syntax.
"valid-jsdoc": "off",
"jsdoc/check-indentation": "warn",
"jsdoc/check-param-names": "off",
"jsdoc/check-values": [
"error",
{
allowedLicenses: true,
licensePattern:
"^\nCopyright 2021 Google LLC\nSPDX-License-Identifier: Apache-2\\.0$",
},
],
// Non-test files require both @license and a @fileoverview.
"jsdoc/require-file-overview": [
"error",
{
tags: {
file: {
mustExist: true,
preventDuplicates: true,
initialCommentsOnly: true,
},
license: {
mustExist: true,
preventDuplicates: true,
initialCommentsOnly: true,
},
},
},
],
"jsdoc/require-jsdoc": ["warn", { publicOnly: true }],
"jsdoc/require-param": "off",
"jsdoc/require-param-type": "off",
"jsdoc/require-returns": "off",
"jsdoc/require-returns-type": "off",
// @fileoverview tags should be allowed to have multiple paragraphs, but
// there's currently no way to specify this, so we just have to disable the
// rule entirely. It can be reenabled after a release goes out containing
// https://github.com/gajus/eslint-plugin-jsdoc/pull/741.
"jsdoc/tag-lines": "off",
},
overrides: [
{
files: ["*_test.ts"],
rules: {
// Same issue as with Jest
// (https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/unbound-method.md),
// but there's currently no Jasmine equivalent of
// eslint-plugin-jest/unbound-method, so we have to just disable the
// rule entirely.
"@typescript-eslint/unbound-method": "off",
// Test files require @license, but not @fileoverview.
"jsdoc/require-file-overview": [
"error",
{
tags: {
license: {
mustExist: true,
preventDuplicates: true,
initialCommentsOnly: true,
},
},
},
],
},
},
],
settings: {
jsdoc: {
// Google Style uses these tag names.
tagNamePreference: { file: "fileoverview", returns: "return" },
},
},
};