Skip to content

Commit ccfebdf

Browse files
committed
Fix violations
1 parent 5fd7271 commit ccfebdf

12 files changed

+31
-28
lines changed

lib/rules/array-foreach.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = {
1212
return {
1313
CallExpression(node) {
1414
if (node.callee.property && node.callee.property.name === 'forEach') {
15-
context.report(node, 'Prefer for...of instead of Array.forEach')
15+
context.report({node, message: 'Prefer for...of instead of Array.forEach'})
1616
}
1717
}
1818
}

lib/rules/async-currenttarget.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module.exports = {
1919
if (node.property && node.property.name === 'currentTarget') {
2020
const scope = context.getScope()
2121
if (scope.block.async && scopeDidWait.has(scope)) {
22-
context.report(node, 'event.currentTarget inside an async function is error prone')
22+
context.report({node, message: 'event.currentTarget inside an async function is error prone'})
2323
}
2424
}
2525
}

lib/rules/async-preventdefault.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module.exports = {
1919
if (node.callee.property && node.callee.property.name === 'preventDefault') {
2020
const scope = context.getScope()
2121
if (scope.block.async && scopeDidWait.has(scope)) {
22-
context.report(node, 'event.preventDefault() inside an async function is error prone')
22+
context.report({node, message: 'event.preventDefault() inside an async function is error prone'})
2323
}
2424
}
2525
}

lib/rules/authenticity-token.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ module.exports = {
1111
create(context) {
1212
function checkAuthenticityTokenUsage(node, str) {
1313
if (str.includes('authenticity_token')) {
14-
context.report(
14+
context.report({
1515
node,
16-
'Form CSRF tokens (authenticity tokens) should not be created in JavaScript and their values should not be used directly for XHR requests.'
17-
)
16+
message:
17+
'Form CSRF tokens (authenticity tokens) should not be created in JavaScript and their values should not be used directly for XHR requests.'
18+
})
1819
}
1920
}
2021

lib/rules/js-class-name.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ module.exports = {
1717
const matches = str.match(allJsClassNameRegexp) || []
1818
for (const match of matches) {
1919
if (!match.match(validJsClassNameRegexp)) {
20-
context.report(node, 'js- class names should be lowercase and only contain dashes.')
20+
context.report({node, message: 'js- class names should be lowercase and only contain dashes.'})
2121
}
2222
}
2323
}
2424

2525
function checkStringEndsWithJSClassName(node, str) {
2626
if (str.match(endWithJsClassNameRegexp)) {
27-
context.report(node, 'js- class names should be statically defined.')
27+
context.report({node, message: 'js- class names should be statically defined.'})
2828
}
2929
}
3030

lib/rules/no-blur.js

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
module.exports = function (context) {
2-
return {
3-
meta: {
4-
type: 'problem',
5-
docs: {
6-
description: 'disallow usage of `Element.prototype.blur()`',
7-
url: require('../url')(module)
8-
},
9-
schema: []
1+
module.exports = {
2+
meta: {
3+
type: 'problem',
4+
docs: {
5+
description: 'disallow usage of `Element.prototype.blur()`',
6+
url: require('../url')(module)
107
},
11-
CallExpression(node) {
12-
if (node.callee.property && node.callee.property.name === 'blur') {
13-
context.report(node, 'Do not use element.blur(), instead restore the focus of a previous element.')
8+
schema: []
9+
},
10+
create(context) {
11+
return {
12+
CallExpression(node) {
13+
if (node.callee.property && node.callee.property.name === 'blur') {
14+
context.report({node, message: 'Do not use element.blur(), instead restore the focus of a previous element.'})
15+
}
1416
}
1517
}
1618
}

lib/rules/no-dataset.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = {
1212
return {
1313
MemberExpression(node) {
1414
if (node.property && node.property.name === 'dataset') {
15-
context.report(node, "Use getAttribute('data-your-attribute') instead of dataset.")
15+
context.report({node, message: "Use getAttribute('data-your-attribute') instead of dataset."})
1616
}
1717
}
1818
}

lib/rules/no-implicit-buggy-globals.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module.exports = {
2525
(def.type === 'Variable' && def.parent.kind === 'const') ||
2626
(def.type === 'Variable' && def.parent.kind === 'let')
2727
) {
28-
context.report(def.node, 'Implicit global variable, assign as global property instead.')
28+
context.report({node: def.node, message: 'Implicit global variable, assign as global property instead.'})
2929
}
3030
}
3131
}

lib/rules/no-then.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ module.exports = {
1212
return {
1313
MemberExpression(node) {
1414
if (node.property && node.property.name === 'then') {
15-
context.report(node.property, 'Prefer async/await to Promise.then()')
15+
context.report({node: node.property, message: 'Prefer async/await to Promise.then()'})
1616
} else if (node.property && node.property.name === 'catch') {
17-
context.report(node.property, 'Prefer async/await to Promise.catch()')
17+
context.report({node: node.property, message: 'Prefer async/await to Promise.catch()'})
1818
}
1919
}
2020
}

lib/rules/no-useless-passive.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports = {
1515

1616
create(context) {
1717
return {
18-
['CallExpression[callee.property.name="addEventListener"]']: function (node) {
18+
['CallExpression[callee.property.name="addEventListener"]']: function(node) {
1919
const [name, listener, options] = node.arguments
2020
if (name.type !== 'Literal') return
2121
if (passiveEventListenerNames.has(name.value)) return

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy