mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: use private fields (#8506)
This commit is contained in:
37
.eslintrc.js
37
.eslintrc.js
@@ -1,3 +1,12 @@
|
||||
// TODO: Enable this at some point.
|
||||
// const RESTRICTED_UNDERSCORED_IDENTIFIERS = [
|
||||
// 'PropertyDefinition > Identifier[name=/^_[a-z].*$/]',
|
||||
// ].map((selector) => ({
|
||||
// selector,
|
||||
// message:
|
||||
// 'Use private fields (fields prefixed with #) and an appropriate getter/setter.',
|
||||
// }));
|
||||
|
||||
module.exports = {
|
||||
root: true,
|
||||
env: {
|
||||
@@ -15,14 +24,6 @@ module.exports = {
|
||||
// Error if files are not formatted with Prettier correctly.
|
||||
'prettier/prettier': 2,
|
||||
// syntax preferences
|
||||
quotes: [
|
||||
2,
|
||||
'single',
|
||||
{
|
||||
avoidEscape: true,
|
||||
allowTemplateLiterals: true,
|
||||
},
|
||||
],
|
||||
'spaced-comment': [
|
||||
2,
|
||||
'always',
|
||||
@@ -116,6 +117,12 @@ module.exports = {
|
||||
},
|
||||
],
|
||||
'import/extensions': ['error', 'ignorePackages'],
|
||||
|
||||
'no-restricted-syntax': [
|
||||
'error',
|
||||
// Don't allow underscored declarations on camelCased variables/properties.
|
||||
// ...RESTRICTED_UNDERSCORED_IDENTIFIERS,
|
||||
],
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
@@ -144,8 +151,6 @@ module.exports = {
|
||||
// We don't require explicit return types on basic functions or
|
||||
// dummy functions in tests, for example
|
||||
'@typescript-eslint/explicit-function-return-type': 0,
|
||||
// We know it's bad and use it very sparingly but it's needed :(
|
||||
'@typescript-eslint/ban-ts-ignore': 0,
|
||||
// We allow non-null assertions if the value was asserted using `assert` API.
|
||||
'@typescript-eslint/no-non-null-assertion': 0,
|
||||
/**
|
||||
@@ -176,6 +181,18 @@ module.exports = {
|
||||
],
|
||||
// By default this is a warning but we want it to error.
|
||||
'@typescript-eslint/explicit-module-boundary-types': 2,
|
||||
|
||||
'no-restricted-syntax': [
|
||||
'error',
|
||||
{
|
||||
// Never use `require` in TypeScript since they are transpiled out.
|
||||
selector: "CallExpression[callee.name='require']",
|
||||
message: '`require` statements are not allowed. Use `import`.',
|
||||
},
|
||||
|
||||
// Don't allow underscored declarations on camelCased variables/properties.
|
||||
// ...RESTRICTED_UNDERSCORED_IDENTIFIERS,
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user