Skip to content
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

chore: export eslint-plugin types #175

Merged
merged 1 commit into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ packages/website/src/docs/**/*.html
packages/website/src/out/**/*.html
packages/**/dist
*.tsbuildinfo
packages/parser/types
.parcel-cache/
.pnp.*
.yarn/*
Expand All @@ -20,3 +19,7 @@ packages/**/.yarn
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# generated types
packages/parser/types
packages/eslint-plugin/types
5 changes: 4 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ packages/website/**/*.html
packages/web-linter/out
.next
dist
packages/parser/types
**/dist
.yarn/releases
yarn.lock

# generated types
packages/parser/types
packages/eslint-plugin/types
13 changes: 10 additions & 3 deletions packages/eslint-plugin/lib/rules/element-newline.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* @typedef { import("../types").RuleModule } RuleModule
* @typedef { import("../types").ProgramNode } ProgramNode
* @typedef { import("../types").TagNode } TagNode
* @typedef { import("../types").BaseNode } BaseNode
*/

const { RULE_CATEGORY } = require("../constants");

const MESSAGE_IDS = {
Expand All @@ -6,7 +13,7 @@ const MESSAGE_IDS = {
};

/**
* @type {Rule}
* @type {RuleModule}
*/
module.exports = {
meta: {
Expand Down Expand Up @@ -45,7 +52,7 @@ module.exports = {
const skipTags = option.skip;
let skipTagCount = 0;
/**
* @param {ChildType<TagNode | ProgramNode>[]} siblings
* @param {import("../types").ChildType<TagNode | ProgramNode>[]} siblings
*/
function checkSiblings(siblings) {
siblings
Expand All @@ -70,7 +77,7 @@ module.exports = {

/**
* @param {TagNode} node
* @param {ChildType<TagNode>[]} children
* @param {import("../types").ChildType<TagNode>[]} children
*/
function checkChild(node, children) {
const targetChildren = children.filter((n) => n.type !== "Text");
Expand Down
9 changes: 8 additions & 1 deletion packages/eslint-plugin/lib/rules/id-naming-convention.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* @typedef { import("../types").RuleModule } RuleModule
* @typedef { import("../types").TagNode } TagNode
* @typedef { import("../types").ScriptTagNode } ScriptTagNode
* @typedef { import("../types").StyleTagNode } StyleTagNode
*/

const { RULE_CATEGORY } = require("../constants");
const {
isCamelCase,
Expand Down Expand Up @@ -27,7 +34,7 @@ const CONVENTION_CHECKERS = {
};

/**
* @type {Rule}
* @type {RuleModule}
*/
module.exports = {
meta: {
Expand Down
8 changes: 6 additions & 2 deletions packages/eslint-plugin/lib/rules/indent.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
/**
* @typedef { import("../types").RuleModule } RuleModule
* @typedef { import("../types").AnyNode } AnyNode
* @typedef { import("../types").LineNode } LineNode
* @typedef { import("../types").BaseNode } BaseNode
* @typedef { import("../types").TagNode } TagNode
* @typedef {Object} IndentType
* @property {"tab"} TAB
* @property {"space"} SPACE
*
* @typedef {Object} MessageId
* @property {"wrongIndent"} WRONG_INDENT
*/
Expand All @@ -24,7 +28,7 @@ const INDENT_TYPES = {
const IGNORING_NODES = ["pre", "xmp"];

/**
* @type {Rule}
* @type {RuleModule}
*/
module.exports = {
meta: {
Expand Down
9 changes: 8 additions & 1 deletion packages/eslint-plugin/lib/rules/lowercase.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* @typedef { import("../types").RuleModule } RuleModule
* @typedef { import("../types").TagNode } TagNode
* @typedef { import("../types").StyleTagNode } StyleTagNode
* @typedef { import("../types").ScriptTagNode } ScriptTagNode
*/

const { NODE_TYPES } = require("@html-eslint/parser");
const { RULE_CATEGORY } = require("../constants");

Expand All @@ -6,7 +13,7 @@ const MESSAGE_IDS = {
};

/**
* @type {Rule}
* @type {RuleModule}
*/
module.exports = {
meta: {
Expand Down
9 changes: 8 additions & 1 deletion packages/eslint-plugin/lib/rules/no-abstract-roles.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* @typedef { import("../types").RuleModule } RuleModule
* @typedef { import("../types").TagNode } TagNode
* @typedef { import("../types").StyleTagNode } StyleTagNode
* @typedef { import("../types").ScriptTagNode } ScriptTagNode
*/

const { RULE_CATEGORY } = require("../constants");
const { findAttr } = require("./utils/node");

Expand All @@ -21,7 +28,7 @@ const ABSTRACT_ROLE_SET = new Set([
]);

/**
* @type {Rule}
* @type {RuleModule}
*/
module.exports = {
meta: {
Expand Down
9 changes: 8 additions & 1 deletion packages/eslint-plugin/lib/rules/no-accesskey-attrs.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* @typedef { import("../types").RuleModule } RuleModule
* @typedef { import("../types").TagNode } TagNode
* @typedef { import("../types").StyleTagNode } StyleTagNode
* @typedef { import("../types").ScriptTagNode } ScriptTagNode
*/

const { RULE_CATEGORY } = require("../constants");
const { findAttr } = require("./utils/node");

Expand All @@ -6,7 +13,7 @@ const MESSAGE_IDS = {
};

/**
* @type {Rule}
* @type {RuleModule}
*/
module.exports = {
meta: {
Expand Down
6 changes: 5 additions & 1 deletion packages/eslint-plugin/lib/rules/no-aria-hidden-body.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* @typedef { import("../types").RuleModule } RuleModule
*/

const { RULE_CATEGORY } = require("../constants");
const { findAttr } = require("./utils/node");

Expand All @@ -6,7 +10,7 @@ const MESSAGE_IDS = {
};

/**
* @type {Rule}
* @type {RuleModule}
*/
module.exports = {
meta: {
Expand Down
9 changes: 8 additions & 1 deletion packages/eslint-plugin/lib/rules/no-duplicate-attrs.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
/**
* @typedef { import("../types").RuleModule } RuleModule
* @typedef { import("../types").TagNode } TagNode
* @typedef { import("../types").StyleTagNode } StyleTagNode
* @typedef { import("../types").ScriptTagNode } ScriptTagNode
*/

const { RULE_CATEGORY } = require("../constants");

const MESSAGE_IDS = {
DUPLICATE_ATTRS: "duplicateAttrs",
};

/**
* @type {Rule}
* @type {RuleModule}
*/
module.exports = {
meta: {
Expand Down
9 changes: 8 additions & 1 deletion packages/eslint-plugin/lib/rules/no-duplicate-id.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* @typedef { import("../types").RuleModule } RuleModule
* @typedef { import("../types").TagNode } TagNode
* @typedef { import("../types").StyleTagNode } StyleTagNode
* @typedef { import("../types").ScriptTagNode } ScriptTagNode
*/

const { RULE_CATEGORY } = require("../constants");
const { findAttr } = require("./utils/node");

Expand All @@ -6,7 +13,7 @@ const MESSAGE_IDS = {
};

/**
* @type {Rule}
* @type {RuleModule}
*/
module.exports = {
meta: {
Expand Down
17 changes: 16 additions & 1 deletion packages/eslint-plugin/lib/rules/no-extra-spacing-attrs.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/**
* @typedef { import("../types").RuleModule } RuleModule
* @typedef { import("../types").AttributeNode } AttributeNode
* @typedef { import("../types").OpenTagEndNode } OpenTagEndNode
* @typedef { import("../types").OpenScriptTagEndNode } OpenScriptTagEndNode
* @typedef { import("../types").OpenStyleTagEndNode } OpenStyleTagEndNode
* @typedef { import("../types").OpenScriptTagStartNode } OpenScriptTagStartNode
* @typedef { import("../types").OpenTagStartNode } OpenTagStartNode
* @typedef { import("../types").OpenStyleTagStartNode } OpenStyleTagStartNode
* @typedef { import("../types").TagNode } TagNode
* @typedef { import("../types").StyleTagNode } StyleTagNode
* @typedef { import("../types").ScriptTagNode } ScriptTagNode
* @typedef { import("../types").AnyNode } AnyNode
*/

const { RULE_CATEGORY } = require("../constants");
const { getLocBetween } = require("./utils/node");

Expand All @@ -11,7 +26,7 @@ const MESSAGE_IDS = {
};

/**
* @type {Rule}
* @type {RuleModule}
*/
module.exports = {
meta: {
Expand Down
6 changes: 5 additions & 1 deletion packages/eslint-plugin/lib/rules/no-inline-styles.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* @typedef { import("../types").RuleModule } RuleModule
*/

const { RULE_CATEGORY } = require("../constants");
const { findAttr } = require("./utils/node");

Expand All @@ -6,7 +10,7 @@ const MESSAGE_IDS = {
};

/**
* @type {Rule}
* @type {RuleModule}
*/
module.exports = {
meta: {
Expand Down
7 changes: 6 additions & 1 deletion packages/eslint-plugin/lib/rules/no-multiple-empty-lines.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
/**
* @typedef { import("../types").RuleModule } RuleModule
* @typedef { import("../types").ProgramNode } ProgramNode
*/

const { RULE_CATEGORY } = require("../constants");

const MESSAGE_IDS = {
UNEXPECTED: "unexpected",
};

/**
* @type {Rule}
* @type {RuleModule}
*/
module.exports = {
meta: {
Expand Down
7 changes: 6 additions & 1 deletion packages/eslint-plugin/lib/rules/no-multiple-h1.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
/**
* @typedef { import("../types").RuleModule } RuleModule
* @typedef { import("../types").TagNode } TagNode
*/

const { RULE_CATEGORY } = require("../constants");

const MESSAGE_IDS = {
MULTIPLE_H1: "unexpectedMultiH1",
};

/**
* @type {Rule}
* @type {RuleModule}
*/
module.exports = {
meta: {
Expand Down
6 changes: 5 additions & 1 deletion packages/eslint-plugin/lib/rules/no-non-scalable-viewport.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* @typedef { import("../types").RuleModule } RuleModule
*/

const { RULE_CATEGORY } = require("../constants");
const { findAttr } = require("./utils/node");

Expand All @@ -6,7 +10,7 @@ const MESSAGE_IDS = {
};

/**
* @type {Rule}
* @type {RuleModule}
*/
module.exports = {
meta: {
Expand Down
6 changes: 5 additions & 1 deletion packages/eslint-plugin/lib/rules/no-obsolete-tags.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* @typedef { import("../types").RuleModule } RuleModule
*/

const { RULE_CATEGORY, OBSOLETE_TAGS } = require("../constants");

const OBSOLETE_TAGS_SET = new Set(OBSOLETE_TAGS);
Expand All @@ -7,7 +11,7 @@ const MESSAGE_IDS = {
};

/**
* @type {Rule}
* @type {RuleModule}
*/
module.exports = {
meta: {
Expand Down
9 changes: 8 additions & 1 deletion packages/eslint-plugin/lib/rules/no-positive-tabindex.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* @typedef { import("../types").RuleModule } RuleModule
* @typedef { import("../types").TagNode } TagNode
* @typedef { import("../types").StyleTagNode } StyleTagNode
* @typedef { import("../types").ScriptTagNode } ScriptTagNode
*/

const { RULE_CATEGORY } = require("../constants");
const { findAttr } = require("./utils/node");

Expand All @@ -6,7 +13,7 @@ const MESSAGE_IDS = {
};

/**
* @type {Rule}
* @type {RuleModule}
*/
module.exports = {
meta: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
/**
* @typedef { import("../types").RuleModule } RuleModule
* @typedef { import("../types").StyleTagNode } StyleTagNode
* @typedef { import("../types").AttributeNode } AttributeNode
* @typedef { import("../types").TagNode } TagNode
* @typedef { import("../types").ScriptTagNode } ScriptTagNode
* @typedef {{attrPatterns: string[], attrValuePatterns: string[], message?: string}[]} Options
*/

Expand All @@ -9,7 +14,7 @@ const MESSAGE_IDS = {
};

/**
* @type {Rule}
* @type {RuleModule}
*/
module.exports = {
meta: {
Expand Down
7 changes: 6 additions & 1 deletion packages/eslint-plugin/lib/rules/no-restricted-attrs.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
/**
* @typedef { import("../types").RuleModule } RuleModule
* @typedef { import("../types").StyleTagNode } StyleTagNode
* @typedef { import("../types").AttributeNode } AttributeNode
* @typedef { import("../types").TagNode } TagNode
* @typedef { import("../types").ScriptTagNode } ScriptTagNode
* @typedef {{tagPatterns: string[], attrPatterns: string[], message?: string}[]} Options
*/

Expand All @@ -10,7 +15,7 @@ const MESSAGE_IDS = {
};

/**
* @type {Rule}
* @type {RuleModule}
*/
module.exports = {
meta: {
Expand Down
Loading
Loading