Linting for Typescript Projects
Run the following command to add SwiftWC to your project:
bash
npm i -D eslint@latest @eslint/js@latest @swiftwc/eslint-plugin@latestbash
bun add --exact eslint@latest @eslint/js@latest @swiftwc/eslint-plugin@latest --devAdd this to your ESLint configuration file:
Modify eslint.config.js like this:
eslint.config.js
js
import html from "@html-eslint/eslint-plugin";
import parser from "@html-eslint/parser";
import swiftwc from "@swiftwc/eslint-plugin/html/en";
export default [
{
files: ["**/*.html"],
languageOptions: {
parser,
},
plugins: {
html,
swiftwc,
},
language: "html/html",
rules: {
...swiftwc.configs.recommended.rules,
// 👇🏻 customize above rules here
},
},
];@html-eslint/eslint-plugin and @html-eslint/parser are required for linting HTML files
They are used to understand your code before applying any rules.
npm
bash
npm i -D @html-eslint/eslint-plugin @html-eslint/parserbun
bash
bun add --exact @html-eslint/eslint-plugin @html-eslint/parser --dev