@html-eslint/parser
Advanced tools
Comparing version 0.33.0 to 0.34.0-alpha.0
const { parseForESLint } = require("./parser"); | ||
const meta = require("./meta"); | ||
const { NODE_TYPES } = require("./node-types"); | ||
const TEMPLATE_ENGINE_SYNTAX = require("./template-engine-syntax-preset"); | ||
@@ -9,2 +10,3 @@ module.exports.parseForESLint = parseForESLint; | ||
module.exports = { | ||
TEMPLATE_ENGINE_SYNTAX, | ||
parseForESLint, | ||
@@ -11,0 +13,0 @@ NODE_TYPES, |
/** | ||
* @typedef {import("./types").ProgramNode} ProgramNode | ||
* @typedef {import("./types").ParserOptions} ParserOptions | ||
*/ | ||
@@ -8,10 +8,23 @@ const { parse } = require("es-html-parser"); | ||
const { NODE_TYPES } = require("./node-types"); | ||
const templateSyntaxParser = require("@html-eslint/template-syntax-parser"); | ||
/** | ||
* @param {string} code | ||
* @returns {ProgramNode} | ||
* @param {ParserOptions | undefined} parserOptions | ||
* @returns {any} | ||
*/ | ||
module.exports.parseForESLint = function parseForESLint(code) { | ||
const { ast, tokens } = parse(code); | ||
module.exports.parseForESLint = function parseForESLint(code, parserOptions) { | ||
const options = | ||
(parserOptions && | ||
parserOptions.templateEngineSyntax && { | ||
templateRanges: templateSyntaxParser | ||
.parse(code, { | ||
syntax: parserOptions.templateEngineSyntax, | ||
}) | ||
.syntax.map((s) => s.range), | ||
}) || | ||
undefined; | ||
const { ast, tokens } = parse(code, options); | ||
const programNode = { | ||
@@ -18,0 +31,0 @@ type: "Program", |
{ | ||
"name": "@html-eslint/parser", | ||
"version": "0.33.0", | ||
"version": "0.34.0-alpha.0", | ||
"description": "Parser for @html-eslint/eslint-plugin", | ||
@@ -38,2 +38,3 @@ "author": "yeonjuan", | ||
"dependencies": { | ||
"@html-eslint/template-syntax-parser": "^0.34.0-alpha.0", | ||
"es-html-parser": "^1.0.0-alpha.4" | ||
@@ -44,3 +45,3 @@ }, | ||
}, | ||
"gitHead": "4a0ee932a671f8c54bf1a86849fe886e9628b777" | ||
"gitHead": "4c4b4673a068ddc2f37bb2581048bdbfd09b34b2" | ||
} |
import { parseForESLint } from "./parser"; | ||
import { NODE_TYPES } from "./node-types"; | ||
import TEMPLATE_ENGINE_SYNTAX = require("./template-engine-syntax-preset"); | ||
import meta = require("./meta"); | ||
export { parseForESLint, NODE_TYPES, meta }; | ||
export { parseForESLint, NODE_TYPES, TEMPLATE_ENGINE_SYNTAX, meta }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,3 +0,3 @@ | ||
export function parseForESLint(code: string): ProgramNode; | ||
export type ProgramNode = any; | ||
export function parseForESLint(code: string, parserOptions: ParserOptions | undefined): any; | ||
export type ParserOptions = import("./types").ParserOptions; | ||
//# sourceMappingURL=parser.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export type AnyHTMLNode = any; | ||
export type AnyHTMLNode = import("./types").AnyHTMLNode; | ||
/** | ||
@@ -3,0 +3,0 @@ * |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
40664
26
244
2
+ Added@html-eslint/template-syntax-parser@0.34.0(transitive)