|
| 1 | +/** |
| 2 | + * @license |
| 3 | + * Copyright 2020 Google LLC |
| 4 | + * |
| 5 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | + * you may not use this file except in compliance with the License. |
| 7 | + * You may obtain a copy of the License at |
| 8 | + * |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + * |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + * See the License for the specific language governing permissions and |
| 15 | + * limitations under the License. |
| 16 | + */ |
| 17 | + |
1 | 18 | const path = require('path'); |
2 | 19 |
|
3 | 20 | module.exports = { |
@@ -128,12 +145,29 @@ module.exports = { |
128 | 145 | 'Object': "Use {} or 'object' instead.", |
129 | 146 | 'String': "Use 'string' instead.", |
130 | 147 | 'Number': "Use 'number' instead.", |
131 | | - 'Boolean': "Use 'boolean' instead." |
| 148 | + 'Boolean': "Use 'boolean' instead.", |
| 149 | + 'Function': `Avoid the Function type, as it provides little safety for the following reasons: |
| 150 | + It provides no type safety when calling the value, which means it's easy to provide the wrong arguments. |
| 151 | + It accepts class declarations, which will fail when called, as they are called without the new keyword.` |
| 152 | + }, |
| 153 | + 'extendDefaults': false |
| 154 | + } |
| 155 | + ], |
| 156 | + '@typescript-eslint/naming-convention': [ |
| 157 | + 'error', |
| 158 | + { |
| 159 | + 'selector': 'class', |
| 160 | + 'format': ['PascalCase'] |
| 161 | + }, |
| 162 | + { |
| 163 | + 'selector': 'interface', |
| 164 | + 'format': ['PascalCase'], |
| 165 | + 'custom': { |
| 166 | + 'regex': '^I[A-Z]', |
| 167 | + 'match': false |
132 | 168 | } |
133 | 169 | } |
134 | 170 | ], |
135 | | - '@typescript-eslint/class-name-casing': 'error', |
136 | | - '@typescript-eslint/interface-name-prefix': ['error', 'never'], |
137 | 171 | '@typescript-eslint/consistent-type-definitions': ['error', 'interface'], |
138 | 172 | '@typescript-eslint/explicit-member-accessibility': [ |
139 | 173 | 'error', |
|
0 commit comments