• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2022 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17module.exports = {
18  extends: ['eslint-config-prettier', 'eslint:recommended'],
19  plugins: ['eslint-plugin-prettier', '@typescript-eslint'],
20  parser: '@typescript-eslint/parser',
21  parserOptions: {
22    ecmaVersion: 'latest',
23    sourceType: 'module',
24  },
25  env: {
26    es2022: true,
27    node: true,
28    browser: true,
29    webextensions: true,
30    jasmine: true,
31    protractor: true,
32  },
33  rules: {
34    'no-unused-vars': 'off', // not very robust rule
35
36    // Partially taken from https://github.com/google/eslint-config-google
37    // Omitted layout & formatting rules because that's handled by prettier
38    'no-var': 'error',
39    'prefer-const': ['error', {destructuring: 'all'}],
40    'prefer-rest-params': 'error',
41    'prefer-spread': 'error',
42  },
43  globals: {
44    // Specify NodeJS global as temporary workaround for eslint bug:
45    // https://stackoverflow.com/questions/64089216/after-upgrade-eslint-says-nodejs-is-undefined
46    // https://github.com/Chatie/eslint-config/issues/45
47    NodeJS: true,
48  },
49};
50