From ed8afedbdb281ae16dc1fdf4d7b0751e34f8212a Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Tue, 24 Jul 2018 17:18:32 +0900 Subject: [PATCH 1/8] Chore: upgrade deps --- package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index e295c0148..d88ca41e9 100644 --- a/package.json +++ b/package.json @@ -38,24 +38,24 @@ "url": "https://github.com/vuejs/eslint-plugin-vue/issues" }, "engines": { - "node": ">=4" + "node": ">=6.5" }, "peerDependencies": { - "eslint": "^3.18.0 || ^4.0.0" + "eslint": "^5.0.0" }, "dependencies": { - "vue-eslint-parser": "^2.0.3" + "vue-eslint-parser": "^3.2.1" }, "devDependencies": { "@types/node": "^4.2.16", "babel-eslint": "^8.2.2", "chai": "^4.1.0", - "eslint": "^4.14.0", - "eslint-plugin-eslint-plugin": "^0.8.0", + "eslint": "^5.2.0", + "eslint-plugin-eslint-plugin": "^1.4.0", "eslint-plugin-html": "^4.0.1", - "eslint-plugin-vue-libs": "^2.0.0", + "eslint-plugin-vue-libs": "^3.0.0", "lodash": "^4.17.4", - "mocha": "^3.2.0", - "nyc": "^11.1.0" + "mocha": "^5.2.0", + "nyc": "^12.0.2" } } From fd58b65816136d281c5750f861191d1094519fea Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Tue, 24 Jul 2018 17:22:01 +0900 Subject: [PATCH 2/8] Fix: no-parsing-error test (refs #398) --- tests/lib/rules/no-parsing-error.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tests/lib/rules/no-parsing-error.js b/tests/lib/rules/no-parsing-error.js index fcb4c351a..365bbb09e 100644 --- a/tests/lib/rules/no-parsing-error.js +++ b/tests/lib/rules/no-parsing-error.js @@ -207,7 +207,8 @@ tester.run('no-parsing-error', rule, { options: [{ 'x-invalid-namespace': false }] }, '', - '' + '', + '' ], invalid: [ { @@ -230,13 +231,6 @@ tester.run('no-parsing-error', rule, { code: '', errors: ['Parsing error: Unexpected token ;.'] }, - { - filename: 'test.vue', - code: '', - errors: [ - { message: 'Parsing error: Expected to be an expression, but got empty.', column: 18 } - ] - }, { filename: 'test.vue', code: '', From ca853cb042e450b9e2d47f8056c16834f960751b Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Tue, 24 Jul 2018 17:35:26 +0900 Subject: [PATCH 3/8] Fix: syntax errors in tests of html-indent The top-level commas are invalid syntax. --- lib/utils/indent-common.js | 2 +- tests/fixtures/html-indent/binary-expression-10.vue | 4 ++-- tests/fixtures/html-indent/sequence-expression-01.vue | 4 ++-- tests/fixtures/html-indent/sequence-expression-02.vue | 4 ++-- tests/fixtures/html-indent/sequence-expression-03.vue | 4 ++-- tests/fixtures/html-indent/sequence-expression-04.vue | 6 +++--- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/utils/indent-common.js b/lib/utils/indent-common.js index f93379daa..b0c604762 100644 --- a/lib/utils/indent-common.js +++ b/lib/utils/indent-common.js @@ -845,7 +845,7 @@ module.exports.defineVisitor = function create (context, tokenStore, defaultOpti if (node.expression != null && node.range[0] !== node.expression.range[0]) { const startQuoteToken = tokenStore.getFirstToken(node) const endQuoteToken = tokenStore.getLastToken(node) - const childToken = tokenStore.getFirstToken(node.expression) + const childToken = tokenStore.getTokenAfter(startQuoteToken) setOffset(childToken, 1, startQuoteToken) setOffset(endQuoteToken, 0, startQuoteToken) diff --git a/tests/fixtures/html-indent/binary-expression-10.vue b/tests/fixtures/html-indent/binary-expression-10.vue index 0ecd1e897..6dd5e6f34 100644 --- a/tests/fixtures/html-indent/binary-expression-10.vue +++ b/tests/fixtures/html-indent/binary-expression-10.vue @@ -1,13 +1,13 @@ diff --git a/tests/fixtures/html-indent/sequence-expression-01.vue b/tests/fixtures/html-indent/sequence-expression-01.vue index 9d3db5f79..74307fb26 100644 --- a/tests/fixtures/html-indent/sequence-expression-01.vue +++ b/tests/fixtures/html-indent/sequence-expression-01.vue @@ -1,12 +1,12 @@ diff --git a/tests/fixtures/html-indent/sequence-expression-02.vue b/tests/fixtures/html-indent/sequence-expression-02.vue index fdb4bee70..93ae519ee 100644 --- a/tests/fixtures/html-indent/sequence-expression-02.vue +++ b/tests/fixtures/html-indent/sequence-expression-02.vue @@ -1,10 +1,10 @@ diff --git a/tests/fixtures/html-indent/sequence-expression-03.vue b/tests/fixtures/html-indent/sequence-expression-03.vue index f9c4b68ab..0d8aaa85b 100644 --- a/tests/fixtures/html-indent/sequence-expression-03.vue +++ b/tests/fixtures/html-indent/sequence-expression-03.vue @@ -1,10 +1,10 @@ diff --git a/tests/fixtures/html-indent/sequence-expression-04.vue b/tests/fixtures/html-indent/sequence-expression-04.vue index c9a2d9845..5fbd60215 100644 --- a/tests/fixtures/html-indent/sequence-expression-04.vue +++ b/tests/fixtures/html-indent/sequence-expression-04.vue @@ -1,8 +1,8 @@ \ No newline at end of file + )}} + From 76d4565e0abc5fdf57c6ea37d5614d9151767466 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Tue, 24 Jul 2018 17:41:11 +0900 Subject: [PATCH 4/8] Fix: html-indent supports new VSlotScopeExpression node --- lib/utils/indent-common.js | 2 +- tests/fixtures/html-indent/slot-scope-01.vue | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 tests/fixtures/html-indent/slot-scope-01.vue diff --git a/lib/utils/indent-common.js b/lib/utils/indent-common.js index b0c604762..afef755f5 100644 --- a/lib/utils/indent-common.js +++ b/lib/utils/indent-common.js @@ -14,7 +14,7 @@ const assert = require('assert') // Helpers // ------------------------------------------------------------------------------ -const KNOWN_NODES = new Set(['ArrayExpression', 'ArrayPattern', 'ArrowFunctionExpression', 'AssignmentExpression', 'AssignmentPattern', 'AwaitExpression', 'BinaryExpression', 'BlockStatement', 'BreakStatement', 'CallExpression', 'CatchClause', 'ClassBody', 'ClassDeclaration', 'ClassExpression', 'ConditionalExpression', 'ContinueStatement', 'DebuggerStatement', 'DoWhileStatement', 'EmptyStatement', 'ExperimentalRestProperty', 'ExperimentalSpreadProperty', 'ExportAllDeclaration', 'ExportDefaultDeclaration', 'ExportNamedDeclaration', 'ExportSpecifier', 'ExpressionStatement', 'ForInStatement', 'ForOfStatement', 'ForStatement', 'FunctionDeclaration', 'FunctionExpression', 'Identifier', 'IfStatement', 'ImportDeclaration', 'ImportDefaultSpecifier', 'ImportNamespaceSpecifier', 'ImportSpecifier', 'LabeledStatement', 'Literal', 'LogicalExpression', 'MemberExpression', 'MetaProperty', 'MethodDefinition', 'NewExpression', 'ObjectExpression', 'ObjectPattern', 'Program', 'Property', 'RestElement', 'ReturnStatement', 'SequenceExpression', 'SpreadElement', 'Super', 'SwitchCase', 'SwitchStatement', 'TaggedTemplateExpression', 'TemplateElement', 'TemplateLiteral', 'ThisExpression', 'ThrowStatement', 'TryStatement', 'UnaryExpression', 'UpdateExpression', 'VariableDeclaration', 'VariableDeclarator', 'WhileStatement', 'WithStatement', 'YieldExpression', 'VAttribute', 'VDirectiveKey', 'VDocumentFragment', 'VElement', 'VEndTag', 'VExpressionContainer', 'VForExpression', 'VIdentifier', 'VLiteral', 'VOnExpression', 'VStartTag', 'VText']) +const KNOWN_NODES = new Set(['ArrayExpression', 'ArrayPattern', 'ArrowFunctionExpression', 'AssignmentExpression', 'AssignmentPattern', 'AwaitExpression', 'BinaryExpression', 'BlockStatement', 'BreakStatement', 'CallExpression', 'CatchClause', 'ClassBody', 'ClassDeclaration', 'ClassExpression', 'ConditionalExpression', 'ContinueStatement', 'DebuggerStatement', 'DoWhileStatement', 'EmptyStatement', 'ExperimentalRestProperty', 'ExperimentalSpreadProperty', 'ExportAllDeclaration', 'ExportDefaultDeclaration', 'ExportNamedDeclaration', 'ExportSpecifier', 'ExpressionStatement', 'ForInStatement', 'ForOfStatement', 'ForStatement', 'FunctionDeclaration', 'FunctionExpression', 'Identifier', 'IfStatement', 'ImportDeclaration', 'ImportDefaultSpecifier', 'ImportNamespaceSpecifier', 'ImportSpecifier', 'LabeledStatement', 'Literal', 'LogicalExpression', 'MemberExpression', 'MetaProperty', 'MethodDefinition', 'NewExpression', 'ObjectExpression', 'ObjectPattern', 'Program', 'Property', 'RestElement', 'ReturnStatement', 'SequenceExpression', 'SpreadElement', 'Super', 'SwitchCase', 'SwitchStatement', 'TaggedTemplateExpression', 'TemplateElement', 'TemplateLiteral', 'ThisExpression', 'ThrowStatement', 'TryStatement', 'UnaryExpression', 'UpdateExpression', 'VariableDeclaration', 'VariableDeclarator', 'WhileStatement', 'WithStatement', 'YieldExpression', 'VAttribute', 'VDirectiveKey', 'VDocumentFragment', 'VElement', 'VEndTag', 'VExpressionContainer', 'VForExpression', 'VIdentifier', 'VLiteral', 'VOnExpression', 'VSlotScopeExpression', 'VStartTag', 'VText']) const LT_CHAR = /[\r\n\u2028\u2029]/ const LINES = /[^\r\n\u2028\u2029]+(?:$|\r\n|[\r\n\u2028\u2029])/g const BLOCK_COMMENT_PREFIX = /^\s*\*/ diff --git a/tests/fixtures/html-indent/slot-scope-01.vue b/tests/fixtures/html-indent/slot-scope-01.vue new file mode 100644 index 000000000..f66533ec6 --- /dev/null +++ b/tests/fixtures/html-indent/slot-scope-01.vue @@ -0,0 +1,17 @@ + + From 13dcc8113161963dbb5884e70d092ffd87221a12 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Tue, 24 Jul 2018 17:48:34 +0900 Subject: [PATCH 5/8] Chore: remove deprecated experimentalObjectRestSpread options --- tests/lib/rules/name-property-casing.js | 5 ++--- .../rules/no-async-in-computed-properties.js | 17 +++++------------ tests/lib/rules/no-dupe-keys.js | 2 +- tests/lib/rules/no-reserved-keys.js | 5 ++--- tests/lib/rules/no-shared-component-data.js | 5 ++--- .../no-side-effects-in-computed-properties.js | 5 ++--- tests/lib/rules/order-in-components.js | 5 ++--- tests/lib/rules/prop-name-casing.js | 5 ++--- tests/lib/rules/require-default-prop.js | 3 +-- tests/lib/rules/require-prop-types.js | 2 +- tests/lib/rules/require-render-return.js | 4 ++-- tests/lib/rules/require-valid-default-prop.js | 4 ++-- tests/lib/rules/valid-v-on.js | 4 ++++ 13 files changed, 28 insertions(+), 38 deletions(-) diff --git a/tests/lib/rules/name-property-casing.js b/tests/lib/rules/name-property-casing.js index d5d833352..1bdeb8769 100644 --- a/tests/lib/rules/name-property-casing.js +++ b/tests/lib/rules/name-property-casing.js @@ -16,9 +16,8 @@ const RuleTester = require('eslint').RuleTester // ------------------------------------------------------------------------------ const parserOptions = { - ecmaVersion: 6, - sourceType: 'module', - ecmaFeatures: { experimentalObjectRestSpread: true } + ecmaVersion: 2018, + sourceType: 'module' } const ruleTester = new RuleTester() diff --git a/tests/lib/rules/no-async-in-computed-properties.js b/tests/lib/rules/no-async-in-computed-properties.js index 2e7c27882..23f59965b 100644 --- a/tests/lib/rules/no-async-in-computed-properties.js +++ b/tests/lib/rules/no-async-in-computed-properties.js @@ -12,15 +12,8 @@ const rule = require('../../../lib/rules/no-async-in-computed-properties') const RuleTester = require('eslint').RuleTester const parserOptions = { - ecmaVersion: 6, - sourceType: 'module', - ecmaFeatures: { experimentalObjectRestSpread: true } -} - -const parserOptions8 = { - ecmaVersion: 8, - sourceType: 'module', - ecmaFeatures: { experimentalObjectRestSpread: true } + ecmaVersion: 2018, + sourceType: 'module' } // ------------------------------------------------------------------------------ @@ -77,7 +70,7 @@ ruleTester.run('no-async-in-computed-properties', rule, { })); } `, - parserOptions: parserOptions8 + parserOptions } ], @@ -93,7 +86,7 @@ ruleTester.run('no-async-in-computed-properties', rule, { } } `, - parserOptions: parserOptions8, + parserOptions, errors: [{ message: 'Unexpected async function declaration in "foo" computed property.', line: 4 @@ -113,7 +106,7 @@ ruleTester.run('no-async-in-computed-properties', rule, { } } `, - parserOptions: parserOptions8, + parserOptions, errors: [{ message: 'Unexpected async function declaration in "foo" computed property.', line: 4 diff --git a/tests/lib/rules/no-dupe-keys.js b/tests/lib/rules/no-dupe-keys.js index f9031d1e6..1abb67642 100644 --- a/tests/lib/rules/no-dupe-keys.js +++ b/tests/lib/rules/no-dupe-keys.js @@ -79,7 +79,7 @@ ruleTester.run('no-dupe-keys', rule, { }, } `, - parserOptions: { ecmaVersion: 8, sourceType: 'module', ecmaFeatures: { experimentalObjectRestSpread: true }} + parserOptions: { ecmaVersion: 2018, sourceType: 'module' } }, { diff --git a/tests/lib/rules/no-reserved-keys.js b/tests/lib/rules/no-reserved-keys.js index cc116f1dc..08c7f244c 100644 --- a/tests/lib/rules/no-reserved-keys.js +++ b/tests/lib/rules/no-reserved-keys.js @@ -12,9 +12,8 @@ const rule = require('../../../lib/rules/no-reserved-keys') const RuleTester = require('eslint').RuleTester const parserOptions = { - ecmaVersion: 7, - sourceType: 'module', - ecmaFeatures: { experimentalObjectRestSpread: true } + ecmaVersion: 2018, + sourceType: 'module' } // ------------------------------------------------------------------------------ diff --git a/tests/lib/rules/no-shared-component-data.js b/tests/lib/rules/no-shared-component-data.js index d1616dd37..ce0e0062b 100644 --- a/tests/lib/rules/no-shared-component-data.js +++ b/tests/lib/rules/no-shared-component-data.js @@ -13,9 +13,8 @@ const rule = require('../../../lib/rules/no-shared-component-data') const RuleTester = require('eslint').RuleTester const parserOptions = { - ecmaVersion: 7, - sourceType: 'module', - ecmaFeatures: { experimentalObjectRestSpread: true } + ecmaVersion: 2018, + sourceType: 'module' } // ------------------------------------------------------------------------------ diff --git a/tests/lib/rules/no-side-effects-in-computed-properties.js b/tests/lib/rules/no-side-effects-in-computed-properties.js index 3eadc45c0..55df66734 100644 --- a/tests/lib/rules/no-side-effects-in-computed-properties.js +++ b/tests/lib/rules/no-side-effects-in-computed-properties.js @@ -12,9 +12,8 @@ const rule = require('../../../lib/rules/no-side-effects-in-computed-properties' const RuleTester = require('eslint').RuleTester const parserOptions = { - ecmaVersion: 6, - sourceType: 'module', - ecmaFeatures: { experimentalObjectRestSpread: true } + ecmaVersion: 2018, + sourceType: 'module' } // ------------------------------------------------------------------------------ diff --git a/tests/lib/rules/order-in-components.js b/tests/lib/rules/order-in-components.js index 2eff407ec..236524e88 100644 --- a/tests/lib/rules/order-in-components.js +++ b/tests/lib/rules/order-in-components.js @@ -10,9 +10,8 @@ const RuleTester = require('eslint').RuleTester const ruleTester = new RuleTester() const parserOptions = { - ecmaVersion: 6, - sourceType: 'module', - ecmaFeatures: { experimentalObjectRestSpread: true } + ecmaVersion: 2018, + sourceType: 'module' } ruleTester.run('order-in-components', rule, { diff --git a/tests/lib/rules/prop-name-casing.js b/tests/lib/rules/prop-name-casing.js index cfeeaf8e8..d9a23a466 100644 --- a/tests/lib/rules/prop-name-casing.js +++ b/tests/lib/rules/prop-name-casing.js @@ -16,9 +16,8 @@ const RuleTester = require('eslint').RuleTester // ------------------------------------------------------------------------------ const parserOptions = { - ecmaVersion: 6, - sourceType: 'module', - ecmaFeatures: { experimentalObjectRestSpread: true } + ecmaVersion: 2018, + sourceType: 'module' } const ruleTester = new RuleTester() diff --git a/tests/lib/rules/require-default-prop.js b/tests/lib/rules/require-default-prop.js index df5fc0afc..efc714410 100644 --- a/tests/lib/rules/require-default-prop.js +++ b/tests/lib/rules/require-default-prop.js @@ -11,8 +11,7 @@ const rule = require('../../../lib/rules/require-default-prop') const RuleTester = require('eslint').RuleTester const parserOptions = { - ecmaVersion: 6, - ecmaFeatures: { experimentalObjectRestSpread: true }, + ecmaVersion: 2018, sourceType: 'module' } diff --git a/tests/lib/rules/require-prop-types.js b/tests/lib/rules/require-prop-types.js index 683e8a5bb..326fbd56b 100644 --- a/tests/lib/rules/require-prop-types.js +++ b/tests/lib/rules/require-prop-types.js @@ -31,7 +31,7 @@ ruleTester.run('require-prop-types', rule, { } } `, - parserOptions: { ecmaVersion: 6, sourceType: 'module', ecmaFeatures: { experimentalObjectRestSpread: true }} + parserOptions: { ecmaVersion: 2018, sourceType: 'module' } }, { filename: 'test.vue', diff --git a/tests/lib/rules/require-render-return.js b/tests/lib/rules/require-render-return.js index c12910ff7..38132b287 100644 --- a/tests/lib/rules/require-render-return.js +++ b/tests/lib/rules/require-render-return.js @@ -12,9 +12,9 @@ const rule = require('../../../lib/rules/require-render-return') const RuleTester = require('eslint').RuleTester const parserOptions = { - ecmaVersion: 6, + ecmaVersion: 2018, sourceType: 'module', - ecmaFeatures: { experimentalObjectRestSpread: true, jsx: true } + ecmaFeatures: { jsx: true } } // ------------------------------------------------------------------------------ diff --git a/tests/lib/rules/require-valid-default-prop.js b/tests/lib/rules/require-valid-default-prop.js index b8794fbfb..241b7ff06 100644 --- a/tests/lib/rules/require-valid-default-prop.js +++ b/tests/lib/rules/require-valid-default-prop.js @@ -12,9 +12,9 @@ const rule = require('../../../lib/rules/require-valid-default-prop') const RuleTester = require('eslint').RuleTester const parserOptions = { - ecmaVersion: 6, + ecmaVersion: 2018, sourceType: 'module', - ecmaFeatures: { experimentalObjectRestSpread: true, jsx: true } + ecmaFeatures: { jsx: true } } function errorMessage (type) { diff --git a/tests/lib/rules/valid-v-on.js b/tests/lib/rules/valid-v-on.js index 46dd8b4ee..3c02be86f 100644 --- a/tests/lib/rules/valid-v-on.js +++ b/tests/lib/rules/valid-v-on.js @@ -82,6 +82,10 @@ tester.run('valid-v-on', rule, { { filename: 'test.vue', code: '' + }, + { + filename: 'test.vue', + code: '' } ], invalid: [ From 077e7184e7e4fe16c0b0e58e247454d7d615a611 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Tue, 24 Jul 2018 17:49:56 +0900 Subject: [PATCH 6/8] Docs: update README.md --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b070b4098..3bac587df 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,8 @@ You can try this plugin on the Web. ## :grey_exclamation: Requirements -- [ESLint](http://eslint.org/) `>=3.18.0`. - - `>=4.7.0` to use `eslint --fix`. - - `>=4.14.0` to use with `babel-eslint`. -- Node.js `>=4.0.0` +- [ESLint](http://eslint.org/) `^5.0.0`. +- Node.js `>=6.5.0` ## :cd: Installation From d9775d210cd1029d88c18d8e481d54ad6e7cbb14 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Tue, 24 Jul 2018 18:18:48 +0900 Subject: [PATCH 7/8] Chore: update circle.yml --- circle.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/circle.yml b/circle.yml index 96c519a76..3d1494456 100644 --- a/circle.yml +++ b/circle.yml @@ -1,16 +1,16 @@ machine: node: - version: 8 + version: 10 dependencies: pre: - nvm install 6 - - nvm install 4 + - nvm install 8 test: override: - - nvm use 4 && npm test - nvm use 6 && npm test - nvm use 8 && npm test + - nvm use 10 && npm test # Test for the minimum version we are supporting. - - nvm use 8 && npm i eslint@3.18.0 --no-save && $(npm bin)/mocha tests/lib/rules/*.js --reporter dot + - nvm use 10 && npm i eslint@5.0.0 --no-save && $(npm bin)/mocha tests/lib/rules/*.js --reporter dot From 41319a090c12ef9035316c5ab0c20fd28334198a Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Tue, 24 Jul 2018 18:58:32 +0900 Subject: [PATCH 8/8] Docs: update README.md --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3bac587df..f0798eb06 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,14 @@ > Official ESLint plugin for Vue.js +## :exclamation: Attention - this is documentation for version `5.x` :exclamation: + +This branch contains `eslint-plugin-vue@next` which is a pre-released `5.0`, but it's not the default version that you get with `npm install eslint-plugin-vue`. In order to install this you need to specify either `"eslint-plugin-vue": "next"` in `package.json` or do `npm install eslint-plugin-vue@next`. + +Please try it and report any issues that you might have encountered. + +If you want to check previous releases [go here](https://github.com/vuejs/eslint-plugin-vue/releases). + ## :art: Playground on the Web You can try this plugin on the Web. @@ -20,7 +28,7 @@ You can try this plugin on the Web. ## :cd: Installation ```bash -npm install --save-dev eslint eslint-plugin-vue +npm install --save-dev eslint eslint-plugin-vue@next ``` ## :rocket: Usage