dpapad | ff82d51 | 2017-05-25 18:40:15 | [diff] [blame] | 1 | // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | module.exports = { |
| 6 | 'root': true, |
| 7 | 'env': { |
| 8 | 'browser': true, |
dpapad | a0617309 | 2020-10-17 03:06:16 | [diff] [blame] | 9 | 'es2020': true, |
Christopher Lam | a5f2ad0 | 2018-12-05 10:05:58 | [diff] [blame] | 10 | }, |
| 11 | 'parserOptions': { |
dpapad | a0617309 | 2020-10-17 03:06:16 | [diff] [blame] | 12 | 'ecmaVersion': 2020, |
dpapad | 12b3c47 | 2019-05-29 02:16:05 | [diff] [blame] | 13 | 'sourceType': 'module', |
dpapad | ff82d51 | 2017-05-25 18:40:15 | [diff] [blame] | 14 | }, |
| 15 | 'rules': { |
| 16 | // Enabled checks. |
Dan Beam | 1a0d9dcb | 2019-01-08 09:05:35 | [diff] [blame] | 17 | 'brace-style': ['error', '1tbs'], |
| 18 | 'curly': ['error', 'multi-line', 'consistent'], |
Dan Beam | b153665 | 2019-02-26 07:36:25 | [diff] [blame] | 19 | 'no-extra-boolean-cast': 'error', |
dpapad | ff82d51 | 2017-05-25 18:40:15 | [diff] [blame] | 20 | 'no-extra-semi': 'error', |
dpapad | 728cff0 | 2017-06-01 01:06:42 | [diff] [blame] | 21 | 'no-new-wrappers': 'error', |
Christopher Lam | a5f2ad0 | 2018-12-05 10:05:58 | [diff] [blame] | 22 | 'no-restricted-properties': [ |
| 23 | 'error', |
| 24 | { |
| 25 | 'object': 'document', |
| 26 | 'property': 'getElementById', |
| 27 | 'message': 'Use $(\'id\') or getSVGElement(\'id\') ' + |
| 28 | 'from chrome://resources/js/util.js instead of ' + |
| 29 | 'document.getElementById(\'id\')', |
dpapad | 2674f928 | 2017-05-31 19:40:39 | [diff] [blame] | 30 | }, |
dpapad | 7b493a4 | 2019-06-22 02:07:09 | [diff] [blame] | 31 | { |
| 32 | 'property': '__lookupGetter__', |
| 33 | 'message': 'Use Object.getOwnPropertyDescriptor', |
| 34 | }, |
| 35 | { |
| 36 | 'property': '__lookupSetter__', |
| 37 | 'message': 'Use Object.getOwnPropertyDescriptor', |
| 38 | }, |
| 39 | { |
| 40 | 'property': '__defineGetter__', |
| 41 | 'message': 'Use Object.defineProperty', |
| 42 | }, |
| 43 | { |
| 44 | 'property': '__defineSetter__', |
| 45 | 'message': 'Use Object.defineProperty', |
| 46 | }, |
Dan Beam | 1aa00a12 | 2020-01-16 00:40:41 | [diff] [blame] | 47 | { |
| 48 | 'object': 'cr', |
| 49 | 'property': 'exportPath', |
| 50 | 'message': 'Use ES modules or cr.define() instead', |
| 51 | }, |
dpapad | 2674f928 | 2017-05-31 19:40:39 | [diff] [blame] | 52 | ], |
Demetrios Papadopoulos | cf870bde | 2019-11-26 19:14:34 | [diff] [blame] | 53 | 'no-var': 'error', |
| 54 | 'prefer-const': 'error', |
dpapad | 1e511b1 | 2017-05-31 03:31:26 | [diff] [blame] | 55 | 'semi': ['error', 'always'], |
dpapad | 2674f928 | 2017-05-31 19:40:39 | [diff] [blame] | 56 | |
dpapad | ff82d51 | 2017-05-25 18:40:15 | [diff] [blame] | 57 | // TODO(dpapad): Add more checks according to our styleguide. |
| 58 | }, |
dpapad | ac97d7b6 | 2021-06-14 07:20:26 | [diff] [blame] | 59 | |
| 60 | 'overrides': [{ |
| 61 | 'files': ['**/*.ts'], |
| 62 | 'parser': './third_party/node/node_modules/@typescript-eslint/parser', |
| 63 | }] |
dpapad | ff82d51 | 2017-05-25 18:40:15 | [diff] [blame] | 64 | }; |