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 ignorePatterns: [ 34 // Perfetto trace processor sources. Either auto-generated (we want to keep them untouched) 35 // or copied from external/perfetto (we want to touch them as little as possible to allow 36 // future upgrading, diffing, conflicts merging, ...) 37 'src/trace_processor/', 38 ], 39 rules: { 40 'no-unused-vars': 'off', // not very robust rule 41 42 // Partially taken from https://github.com/google/eslint-config-google 43 // Omitted layout & formatting rules because that's handled by prettier 44 'no-var': 'error', 45 'prefer-const': ['error', {destructuring: 'all'}], 46 'prefer-rest-params': 'error', 47 'prefer-spread': 'error', 48 'no-restricted-imports': [ 49 'error', 50 { 51 'patterns': ['..*'], 52 }, 53 ], 54 }, 55 globals: { 56 // Specify NodeJS global as temporary workaround for eslint bug: 57 // https://stackoverflow.com/questions/64089216/after-upgrade-eslint-says-nodejs-is-undefined 58 // https://github.com/Chatie/eslint-config/issues/45 59 NodeJS: true, 60 }, 61}; 62