1 // Copyright 2017 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
13 'sourceType': 'module',
17 'brace-style': ['error', '1tbs'],
19 // https://google.github.io/styleguide/jsguide.html#features-arrays-trailing-comma
20 // https://google.github.io/styleguide/jsguide.html#features-objects-use-trailing-comma
21 'comma-dangle': ['error', 'always-multiline'],
23 'curly': ['error', 'multi-line', 'consistent'],
24 'new-parens': 'error',
25 'no-array-constructor': 'error',
26 'no-console': ['error', {allow: ['info', 'warn', 'error', 'assert']}],
27 'no-extra-boolean-cast': 'error',
28 'no-extra-semi': 'error',
29 'no-new-wrappers': 'error',
30 'no-restricted-imports': ['error', {
32 'name': 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js',
33 'importNames': ['Polymer'],
34 'message': 'Use PolymerElement instead.',
37 'name': '//resources/polymer/v3_0/polymer/polymer_bundled.min.js',
38 'importNames': ['Polymer'],
39 'message': 'Use PolymerElement instead.',
42 'no-restricted-properties': [
45 'property': '__lookupGetter__',
46 'message': 'Use Object.getOwnPropertyDescriptor',
49 'property': '__lookupSetter__',
50 'message': 'Use Object.getOwnPropertyDescriptor',
53 'property': '__defineGetter__',
54 'message': 'Use Object.defineProperty',
57 'property': '__defineSetter__',
58 'message': 'Use Object.defineProperty',
62 'property': 'exportPath',
63 'message': 'Use ES modules or cr.define() instead',
66 'no-throw-literal': 'error',
67 'no-trailing-spaces': 'error',
69 'prefer-const': 'error',
70 'quotes': ['error', 'single', {allowTemplateLiterals: true}],
71 'semi': ['error', 'always'],
73 // https://google.github.io/styleguide/jsguide.html#features-one-variable-per-declaration
74 'one-var': ['error', {
79 // TODO(dpapad): Add more checks according to our styleguide.
84 'parser': './third_party/node/node_modules/@typescript-eslint/parser/dist/index.js',
89 'no-unused-vars': 'off',
90 '@typescript-eslint/no-unused-vars': [
92 argsIgnorePattern: '^_',
93 varsIgnorePattern: '^_',
97 // https://google.github.io/styleguide/tsguide.html#array-constructor
98 // Note: The rule below only partially enforces the styleguide, since it
99 // it does not flag invocations of the constructor with a single
101 'no-array-constructor': 'off',
102 '@typescript-eslint/no-array-constructor': 'error',
104 // https://google.github.io/styleguide/tsguide.html#automatic-semicolon-insertion
106 '@typescript-eslint/semi': ['error'],
108 // https://google.github.io/styleguide/tsguide.html#arrayt-type
109 '@typescript-eslint/array-type': ['error', {
110 default: 'array-simple',
113 // https://google.github.io/styleguide/tsguide.html#type-assertions-syntax
114 '@typescript-eslint/consistent-type-assertions': ['error', {
115 assertionStyle: 'as',
118 // https://google.github.io/styleguide/tsguide.html#interfaces-vs-type-aliases
119 '@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
121 // https://google.github.io/styleguide/tsguide.html#visibility
122 '@typescript-eslint/explicit-member-accessibility': ['error', {
123 accessibility: 'no-public',
125 parameterProperties: 'off',
129 // https://google.github.io/styleguide/jsguide.html#naming
130 '@typescript-eslint/naming-convention': [
133 selector: ['class', 'interface', 'typeAlias', 'enum', 'typeParameter'],
134 format: ['StrictPascalCase'],
137 // Exclude TypeScript defined interfaces HTMLElementTagNameMap
138 // and HTMLElementEventMap.
139 'HTMLElementTagNameMap|HTMLElementEventMap|' +
140 // Exclude native DOM types which are always named like HTML<Foo>Element.
141 'HTML[A-Za-z]{0,}Element|' +
142 // Exclude native DOM interfaces.
143 'UIEvent|UIEventInit|DOMError|' +
144 // Exclude the deprecated WebUIListenerBehavior interface.
145 'WebUIListenerBehavior)$',
150 selector: 'enumMember',
151 format: ['UPPER_CASE'],
154 selector: 'classMethod',
155 format: ['strictCamelCase'],
156 modifiers: ['public'],
159 selector: 'classMethod',
160 format: ['strictCamelCase'],
161 modifiers: ['private'],
162 trailingUnderscore: 'allow',
164 // Disallow the 'Tap_' suffix, in favor of 'Click_' in event handlers.
165 // Note: Unfortunately this ESLint rule does not provide a way to
166 // customize the error message to better inform developers.
168 regex: '^on[a-zA-Z0-9]+Tap$',
173 selector: 'classProperty',
174 format: ['UPPER_CASE'],
175 modifiers: ['private', 'static', 'readonly'],
178 selector: 'classProperty',
179 format: ['UPPER_CASE'],
180 modifiers: ['public', 'static', 'readonly'],
183 selector: 'classProperty',
184 format: ['camelCase'],
185 modifiers: ['public'],
188 selector: 'classProperty',
189 format: ['camelCase'],
190 modifiers: ['private'],
191 trailingUnderscore: 'allow',
194 selector: 'parameter',
195 format: ['camelCase'],
196 leadingUnderscore: 'allow',
199 selector: 'function',
200 format: ['camelCase'],
204 // https://google.github.io/styleguide/tsguide.html#member-property-declarations
205 '@typescript-eslint/member-delimiter-style': ['error', {
228 // https://google.github.io/styleguide/tsguide.html#wrapper-types
229 '@typescript-eslint/ban-types': ['error', {
230 extendDefaults: false,
233 message: 'Use string instead',
237 message: 'Use boolean instead',
241 message: 'Use number instead',
245 message: 'Use symbol instead',
249 message: 'Use bigint instead',