-
-
Notifications
You must be signed in to change notification settings - Fork 689
New: some core rules for <template> #680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 9 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
fb35624
add core rule wrapper
mysticatea 6a1ef07
add array-bracket-spacing
mysticatea 096dc56
add eqeqeq
mysticatea adf5d2a
add key-spacing
mysticatea 87115a5
add object-curly-spacing
mysticatea 26c3856
add space-infix-ops
mysticatea 47c6173
add space-unary-ops
mysticatea 6e10cb0
npm run update
mysticatea 50596ab
Merge remote-tracking branch 'origin/master' into some-core-rules
mysticatea b476621
override URL
mysticatea 6ff5419
Merge branch 'master' into some-core-rules
mysticatea ff38ba2
fix tests to follow upstream changes
mysticatea 226545d
switch error messages for minimal version tests
mysticatea File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# enforce consistent spacing inside array brackets (vue/array-bracket-spacing) | ||
|
||
- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule. | ||
|
||
This rule is the same rule as core [array-bracket-spacing] rule but it applies to the expressions in `<template>`. | ||
|
||
## :books: Further reading | ||
|
||
- [array-bracket-spacing] | ||
|
||
[array-bracket-spacing]: https://eslint.org/docs/rules/array-bracket-spacing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# require the use of `===` and `!==` (vue/eqeqeq) | ||
|
||
- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule. | ||
|
||
This rule is the same rule as core [eqeqeq] rule but it applies to the expressions in `<template>`. | ||
|
||
## :books: Further reading | ||
|
||
- [eqeqeq] | ||
|
||
[eqeqeq]: https://eslint.org/docs/rules/eqeqeq |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# enforce consistent spacing between keys and values in object literal properties (vue/key-spacing) | ||
|
||
- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule. | ||
|
||
This rule is the same rule as core [key-spacing] rule but it applies to the expressions in `<template>`. | ||
|
||
## :books: Further reading | ||
|
||
- [key-spacing] | ||
|
||
[key-spacing]: https://eslint.org/docs/rules/key-spacing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# enforce consistent spacing inside braces (vue/object-curly-spacing) | ||
|
||
- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule. | ||
|
||
This rule is the same rule as core [object-curly-spacing] rule but it applies to the expressions in `<template>`. | ||
|
||
## :books: Further reading | ||
|
||
- [object-curly-spacing] | ||
|
||
[object-curly-spacing]: https://eslint.org/docs/rules/object-curly-spacing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# require spacing around infix operators (vue/space-infix-ops) | ||
|
||
- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule. | ||
|
||
This rule is the same rule as core [space-infix-ops] rule but it applies to the expressions in `<template>`. | ||
|
||
## :books: Further reading | ||
|
||
- [space-infix-ops] | ||
|
||
[space-infix-ops]: https://eslint.org/docs/rules/space-infix-ops |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# enforce consistent spacing before or after unary operators (vue/space-unary-ops) | ||
|
||
- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule. | ||
|
||
This rule is the same rule as core [space-unary-ops] rule but it applies to the expressions in `<template>`. | ||
|
||
## :books: Further reading | ||
|
||
- [space-unary-ops] | ||
|
||
[space-unary-ops]: https://eslint.org/docs/rules/space-unary-ops |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* @author Toru Nagashima | ||
*/ | ||
'use strict' | ||
|
||
const { wrapCoreRule } = require('../utils') | ||
|
||
// eslint-disable-next-line | ||
module.exports = wrapCoreRule(require('eslint/lib/rules/array-bracket-spacing')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* @author Toru Nagashima | ||
*/ | ||
'use strict' | ||
|
||
const { wrapCoreRule } = require('../utils') | ||
|
||
// eslint-disable-next-line | ||
module.exports = wrapCoreRule(require('eslint/lib/rules/eqeqeq')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* @author Toru Nagashima | ||
*/ | ||
'use strict' | ||
|
||
const { wrapCoreRule } = require('../utils') | ||
|
||
// eslint-disable-next-line | ||
module.exports = wrapCoreRule(require('eslint/lib/rules/key-spacing')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* @author Toru Nagashima | ||
*/ | ||
'use strict' | ||
|
||
const { wrapCoreRule } = require('../utils') | ||
|
||
// eslint-disable-next-line | ||
module.exports = wrapCoreRule(require('eslint/lib/rules/object-curly-spacing')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* @author Toru Nagashima | ||
*/ | ||
'use strict' | ||
|
||
const { wrapCoreRule } = require('../utils') | ||
|
||
// eslint-disable-next-line | ||
module.exports = wrapCoreRule(require('eslint/lib/rules/space-infix-ops')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/** | ||
* @author Toru Nagashima | ||
*/ | ||
'use strict' | ||
|
||
const { wrapCoreRule } = require('../utils') | ||
|
||
// eslint-disable-next-line | ||
module.exports = wrapCoreRule(require('eslint/lib/rules/space-unary-ops')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/** | ||
* @author Toru Nagashima | ||
*/ | ||
'use strict' | ||
|
||
const RuleTester = require('eslint').RuleTester | ||
const rule = require('../../../lib/rules/array-bracket-spacing') | ||
|
||
const tester = new RuleTester({ | ||
parser: 'vue-eslint-parser', | ||
parserOptions: { ecmaVersion: 2015 } | ||
}) | ||
|
||
tester.run('array-bracket-spacing', rule, { | ||
valid: [ | ||
'<template><div :attr="[a]" /></template>', | ||
{ | ||
code: '<template><div :attr="[a]" /></template>', | ||
options: ['never'] | ||
}, | ||
{ | ||
code: '<template><div :attr="[ a ]" /></template>', | ||
options: ['always'] | ||
} | ||
], | ||
invalid: [ | ||
{ | ||
code: '<template><div :attr="[ a]" /></template>', | ||
errors: ["There should be no space after '['."] | ||
}, | ||
{ | ||
code: '<template><div :attr="[a ]" /></template>', | ||
errors: ["There should be no space before ']'."] | ||
}, | ||
{ | ||
code: '<template><div :attr="[ a ]" /></template>', | ||
errors: [ | ||
"There should be no space after '['.", | ||
"There should be no space before ']'." | ||
] | ||
}, | ||
{ | ||
code: '<template><div :attr="[ a]" /></template>', | ||
options: ['never'], | ||
errors: ["There should be no space after '['."] | ||
}, | ||
{ | ||
code: '<template><div :attr="[a ]" /></template>', | ||
options: ['never'], | ||
errors: ["There should be no space before ']'."] | ||
}, | ||
{ | ||
code: '<template><div :attr="[ a ]" /></template>', | ||
options: ['never'], | ||
errors: [ | ||
"There should be no space after '['.", | ||
"There should be no space before ']'." | ||
] | ||
}, | ||
{ | ||
code: '<template><div :attr="[ a]" /></template>', | ||
options: ['always'], | ||
errors: ["A space is required before ']'."] | ||
}, | ||
{ | ||
code: '<template><div :attr="[a ]" /></template>', | ||
options: ['always'], | ||
errors: ["A space is required after '['."] | ||
}, | ||
{ | ||
code: '<template><div :attr="[a]" /></template>', | ||
options: ['always'], | ||
errors: [ | ||
"A space is required after '['.", | ||
"A space is required before ']'." | ||
] | ||
} | ||
] | ||
}) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.