Skip to content

Commit 62d97bf

Browse files
mysticateamichalsnik
authored andcommitted
Fix: don't use internal APIs of ESLint (fixes #171) (#172)
* Fix: don't use internal APIs of ESLint (fixes #171) * Chore: add tests with old ESLint
1 parent 85137c9 commit 62d97bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+54
-137
lines changed

circle.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ machine:
44

55
dependencies:
66
pre:
7-
- nvm install 7
7+
- nvm install 6
88
- nvm install 8
99

1010
test:
1111
override:
12-
- npm test
12+
- nvm use 4 && npm test
1313
- nvm use 6 && npm test
14-
- nvm use 7 && npm test
1514
- nvm use 8 && npm test
15+
- nvm use 8 && npm i eslint@3.18.0 --no-save && npm run -s test:base

lib/rules/attribute-hyphenation.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function create (context) {
4343
// Public
4444
// ----------------------------------------------------------------------
4545

46-
utils.registerTemplateBodyVisitor(context, {
46+
return utils.defineTemplateBodyVisitor(context, {
4747
VAttribute (node) {
4848
if (!utils.isCustomComponent(node.parent.parent)) return
4949

@@ -53,8 +53,6 @@ function create (context) {
5353
reportIssue(node, name)
5454
}
5555
})
56-
57-
return {}
5856
}
5957

6058
module.exports = {

lib/rules/html-end-tags.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const utils = require('../utils')
2222
* @returns {Object} AST event handlers.
2323
*/
2424
function create (context) {
25-
utils.registerTemplateBodyVisitor(context, {
25+
return utils.defineTemplateBodyVisitor(context, {
2626
VElement (node) {
2727
const name = node.name
2828
const isVoid = utils.isHtmlVoidElementName(name)
@@ -48,8 +48,6 @@ function create (context) {
4848
}
4949
}
5050
})
51-
52-
return {}
5351
}
5452

5553
// ------------------------------------------------------------------------------

lib/rules/html-no-self-closing.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const utils = require('../utils')
2222
* @returns {Object} AST event handlers.
2323
*/
2424
function create (context) {
25-
utils.registerTemplateBodyVisitor(context, {
25+
return utils.defineTemplateBodyVisitor(context, {
2626
'VElement' (node) {
2727
if (utils.isSvgElementNode(node)) {
2828
return
@@ -42,8 +42,6 @@ function create (context) {
4242
})
4343
}
4444
})
45-
46-
return {}
4745
}
4846

4947
// ------------------------------------------------------------------------------

lib/rules/html-quotes.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function create (context) {
2727
const quoteChar = double ? '"' : "'"
2828
const quoteName = double ? 'double quotes' : 'single quotes'
2929

30-
utils.registerTemplateBodyVisitor(context, {
30+
return utils.defineTemplateBodyVisitor(context, {
3131
'VAttribute[value!=null]' (node) {
3232
const text = sourceCode.getText(node.value)
3333
const firstChar = text[0]
@@ -41,8 +41,6 @@ function create (context) {
4141
}
4242
}
4343
})
44-
45-
return {}
4644
}
4745

4846
// ------------------------------------------------------------------------------

lib/rules/html-self-closing.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function create (context) {
8989
const sourceCode = context.getSourceCode()
9090
const options = parseOptions(context.options[0])
9191

92-
utils.registerTemplateBodyVisitor(context, {
92+
return utils.defineTemplateBodyVisitor(context, {
9393
'VElement' (node) {
9494
const elementType = getElementType(node)
9595
const mode = options[elementType]
@@ -132,8 +132,6 @@ function create (context) {
132132
}
133133
}
134134
})
135-
136-
return {}
137135
}
138136

139137
// ------------------------------------------------------------------------------

lib/rules/max-attributes-per-line.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ module.exports = {
7171
const singlelinemMaximum = configuration.singleline
7272
const canHaveFirstLine = configuration.allowFirstLine
7373

74-
utils.registerTemplateBodyVisitor(context, {
74+
return utils.defineTemplateBodyVisitor(context, {
7575
'VStartTag' (node) {
7676
const numberOfAttributes = node.attributes.length
7777

@@ -155,7 +155,5 @@ module.exports = {
155155

156156
return propsPerLine
157157
}
158-
159-
return {}
160158
}
161159
}

lib/rules/mustache-interpolation-spacing.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ module.exports = {
6565
// Public
6666
// ----------------------------------------------------------------------
6767

68-
utils.registerTemplateBodyVisitor(context, {
68+
return utils.defineTemplateBodyVisitor(context, {
6969
'VExpressionContainer[expression!=null]' (node) {
7070
const tokens = template.getTokens(node, {
7171
includeComments: true,
@@ -85,7 +85,5 @@ module.exports = {
8585
}
8686
}
8787
})
88-
89-
return { }
9088
}
9189
}

lib/rules/no-confusing-v-for-v-if.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function isUsingIterationVar (vIf) {
3737
* @returns {Object} AST event handlers.
3838
*/
3939
function create (context) {
40-
utils.registerTemplateBodyVisitor(context, {
40+
return utils.defineTemplateBodyVisitor(context, {
4141
"VAttribute[directive=true][key.name='if']" (node) {
4242
const element = node.parent.parent
4343

@@ -50,8 +50,6 @@ function create (context) {
5050
}
5151
}
5252
})
53-
54-
return {}
5553
}
5654

5755
// ------------------------------------------------------------------------------

lib/rules/no-duplicate-attributes.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function create (context) {
5151
return directiveNames.has(name) || attributeNames.has(name)
5252
}
5353

54-
utils.registerTemplateBodyVisitor(context, {
54+
return utils.defineTemplateBodyVisitor(context, {
5555
'VStartTag' () {
5656
directiveNames.clear()
5757
attributeNames.clear()
@@ -78,8 +78,6 @@ function create (context) {
7878
}
7979
}
8080
})
81-
82-
return {}
8381
}
8482

8583
// ------------------------------------------------------------------------------

0 commit comments

Comments
 (0)