JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 62
  • Score
    100M100P100Q83388F
  • License MIT

ESLint plugin to lint script tags in HTML

Package Exports

  • @nice-move/eslint-plugin-html
  • @nice-move/eslint-plugin-html/lib/index.cjs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@nice-move/eslint-plugin-html) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@nice-move/eslint-plugin-html

ESLint plugin to lint script tags in HTML.

npm github node

Installation

npm install @nice-move/eslint-plugin-html --save-dev

Usage

// eslintrc.js

module.exports = {
  extends: ['plugin:@nice-move/html/recommended']
};

// or

module.exports = {
  extends: ['plugin:@nice-move/html/base']
};

// or

module.exports = {
  overrides: [
    {
      files: ['*.{htm,html}'],
      plugins: ['@nice-move/eslint-plugin-html']
    },
    {
      files: ['**/*.{htm,html}/**/html-script-legacy.js'],
      parserOptions: {
        sourceType: 'script'
      }
    },
    {
      files: ['**/*.{htm,html}/**/html-script-module.js'],
      parserOptions: {
        sourceType: 'module'
      }
    }
  ]
};

Todos

  • SVG support

Tips

Different from eslint-plugin-html

@nice-move/eslint-plugin-html using processor to treat <script> and <script type="module"> differently. It does not support the shared scope of multiple script tags for now.

See: https://github.com/BenoitZugmeyer/eslint-plugin-html/issues/139

And @nice-move/eslint-plugin-html is bundle-able.

Visual Studio Code support

When using Eslint for VS Code, you may need to add following code to settings:

// example: settings.json or .vscode/settings.json
// I don't know why `eslint-plugin-html` don't need this.
{
  "eslint.validate": ["html"]
}