feat(basic): ban deprecated syntax (#194)

This commit is contained in:
曾明健 2023-06-02 22:04:01 +08:00 committed by GitHub
parent 0a9c9b0384
commit 0947ddb151
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -263,21 +263,27 @@ module.exports = {
'error', 'error',
{ name: 'global', message: 'Use `globalThis` instead.' }, { name: 'global', message: 'Use `globalThis` instead.' },
{ name: 'self', message: 'Use `globalThis` instead.' }, { name: 'self', message: 'Use `globalThis` instead.' },
{ name: 'isNaN', message: 'Use `Number.isNaN` instead' }, { name: 'isNaN', message: 'Use `Number.isNaN` instead.' },
{ name: 'isFinite', message: 'Use `Number.isFinite` instead' }, { name: 'isFinite', message: 'Use `Number.isFinite` instead.' },
{ name: 'parseFloat', message: 'Use `Number.parseFloat` instead' }, { name: 'parseFloat', message: 'Use `Number.parseFloat` instead.' },
{ name: 'parseInt', message: 'Use `Number.parseInt` instead' }, { name: 'parseInt', message: 'Use `Number.parseInt` instead.' },
], ],
'no-restricted-properties': [ 'no-restricted-properties': [
'error', 'error',
{ object: 'globalThis', property: 'isNaN', message: 'Use `Number.isNaN` instead' }, { object: 'globalThis', property: 'isNaN', message: 'Use `Number.isNaN` instead.' },
{ object: 'globalThis', property: 'isFinite', message: 'Use `Number.isFinite` instead' }, { object: 'globalThis', property: 'isFinite', message: 'Use `Number.isFinite` instead.' },
{ object: 'globalThis', property: 'parseFloat', message: 'Use `Number.parseFloat` instead' }, { object: 'globalThis', property: 'parseFloat', message: 'Use `Number.parseFloat` instead.' },
{ object: 'globalThis', property: 'parseInt', message: 'Use `Number.parseInt` instead' }, { object: 'globalThis', property: 'parseInt', message: 'Use `Number.parseInt` instead.' },
{ object: 'window', property: 'isNaN', message: 'Use `Number.isNaN` instead' }, { object: 'window', property: 'isNaN', message: 'Use `Number.isNaN` instead.' },
{ object: 'window', property: 'isFinite', message: 'Use `Number.isFinite` instead' }, { object: 'window', property: 'isFinite', message: 'Use `Number.isFinite` instead.' },
{ object: 'window', property: 'parseFloat', message: 'Use `Number.parseFloat` instead' }, { object: 'window', property: 'parseFloat', message: 'Use `Number.parseFloat` instead.' },
{ object: 'window', property: 'parseInt', message: 'Use `Number.parseInt` instead' }, { object: 'window', property: 'parseInt', message: 'Use `Number.parseInt` instead.' },
{ object: 'Math', property: 'pow', message: 'Use the exponentiation operator (**) instead.' },
{ property: '__proto__', message: 'Use `Object.getPrototypeOf` instead.' },
{ property: '__defineGetter__', message: 'Use `Object.defineProperty` instead.' },
{ property: '__defineSetter__', message: 'Use `Object.defineProperty` instead.' },
{ property: '__lookupGetter__', message: 'Use `Object.getOwnPropertyDescriptor` instead.' },
{ property: '__lookupSetter__', message: 'Use `Object.getOwnPropertyDescriptor` instead.' },
], ],
// es6 // es6