update eslint config

This commit is contained in:
Philipp Kühn 2021-12-01 15:40:50 +01:00
parent 400e671454
commit fa18ffe6d7
3 changed files with 11 additions and 3 deletions

View File

@ -35,6 +35,7 @@ module.exports = {
'airbnb-base', 'airbnb-base',
], ],
rules: { rules: {
curly: ['error', 'all'],
'no-continue': 'off', 'no-continue': 'off',
'no-alert': 'off', 'no-alert': 'off',
'no-console': ['warn', { allow: ['warn', 'error'] }], 'no-console': ['warn', { allow: ['warn', 'error'] }],

View File

@ -17,9 +17,13 @@ export class Punctuation extends LinterPlugin {
scan() { scan() {
this.doc.descendants((node, position) => { this.doc.descendants((node, position) => {
if (!node.isText) return if (!node.isText) {
return
}
if (!node.text) return if (!node.text) {
return
}
const matches = this.regex.exec(node.text) const matches = this.regex.exec(node.text)

View File

@ -5,6 +5,9 @@ function getType(value: any): string {
} }
export default function isPlainObject(value: any): value is Record<string, any> { export default function isPlainObject(value: any): value is Record<string, any> {
if (getType(value) !== 'Object') return false if (getType(value) !== 'Object') {
return false
}
return value.constructor === Object && Object.getPrototypeOf(value) === Object.prototype return value.constructor === Object && Object.getPrototypeOf(value) === Object.prototype
} }