-
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update: 'parser:false' skip parsing '<script>' (refs vuejs/eslint-plu…
- Loading branch information
1 parent
f10d801
commit 9b947b1
Showing
3 changed files
with
54 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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 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 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,40 @@ | ||
/** | ||
* @author Toru Nagashima <https://github.com/mysticatea> | ||
* See LICENSE file in root directory for full license. | ||
*/ | ||
"use strict" | ||
|
||
const assert = require("assert") | ||
const { rules } = require("@mysticatea/eslint-plugin") | ||
const parseForESLint = require("..").parseForESLint | ||
const eslint = require("./fixtures/eslint") | ||
const Linter = eslint.Linter | ||
|
||
describe.only("parserOptions", () => { | ||
describe("parser", () => { | ||
const linter = new Linter() | ||
linter.defineParser("vue-eslint-parser", { parseForESLint }) | ||
linter.defineRule( | ||
"vue/valid-template-root", | ||
rules["vue/valid-template-root"] | ||
) | ||
|
||
it("false then skip parsing '<script>'.", () => { | ||
const code = `<template>Hello</template> | ||
<script>This is syntax error</script>` | ||
const config = { | ||
parser: "vue-eslint-parser", | ||
parserOptions: { | ||
parser: false, | ||
}, | ||
rules: { | ||
"vue/valid-template-root": "error", | ||
}, | ||
} | ||
const messages = linter.verify(code, config, "test.vue") | ||
|
||
assert.strictEqual(messages.length, 1) | ||
assert.strictEqual(messages[0].ruleId, "vue/valid-template-root") | ||
}) | ||
}) | ||
}) |