UNPKG

2.43 kBJavaScriptView Raw
1/*
2 * Copyright 2019 Adobe. All rights reserved.
3 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License. You may obtain a copy
5 * of the License at http://www.apache.org/licenses/LICENSE-2.0
6 *
7 * Unless required by applicable law or agreed to in writing, software distributed under
8 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9 * OF ANY KIND, either express or implied. See the License for the specific language
10 * governing permissions and limitations under the License.
11 */
12
13module.exports = {
14 env: {
15 node: true,
16 es6: true,
17 },
18 // this is the root project for all sub modules. stop searching for any
19 // eslintrc files in parent directories.
20 root: true,
21 parserOptions: {
22 sourceType: 'script',
23 ecmaVersion: 10,
24 },
25 plugins: [
26 'header',
27 ],
28 extends: 'airbnb',
29 rules: {
30 strict: 0,
31
32 // Forbid multiple statements in one line
33 'max-statements-per-line': ['error', { max: 1 }],
34
35 // Allow for-of loops
36 'no-restricted-syntax': ['error', 'ForInStatement', 'LabeledStatement', 'WithStatement'],
37
38 // Allow return before else & redundant else statements
39 'no-else-return': 'off',
40
41 // allow dangling underscores for 'fields'
42 'no-underscore-dangle': 'off',
43
44 // Allow marking variables unused using a underscore at the start
45 'no-unused-vars': ['error', {
46 varsIgnorePattern: '^_.*$',
47 argsIgnorePattern: '^_.*$',
48 caughtErrorsIgnorePattern: '^_.*$',
49 }],
50
51 // enforce license header (todo: improve plugin to support patterns for multi-lines)
52 'header/header': [2, 'block', ['',
53 ' * Copyright 2019 Adobe. All rights reserved.',
54 ' * This file is licensed to you under the Apache License, Version 2.0 (the "License");',
55 ' * you may not use this file except in compliance with the License. You may obtain a copy',
56 ' * of the License at http://www.apache.org/licenses/LICENSE-2.0',
57 ' *',
58 ' * Unless required by applicable law or agreed to in writing, software distributed under',
59 ' * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS',
60 ' * OF ANY KIND, either express or implied. See the License for the specific language',
61 ' * governing permissions and limitations under the License.',
62 ' ',
63 ]],
64 },
65};