Neurotic Programmer Masquerade

    @mitsue/vlint

    0.8.1 • Public • Published

    @mitsue/vlint

    A linter for HTML and CSS using Nu html Checker.

    Usage

    1. Install vlint

      npm i --save-dev @mitsue/vlint
    2. Put .vlintrc.yml in your project directory.

      html:
          vnu: https://example.com/
      css:
          vnu: https://example.com/

      Note: By specifying url of Nu Html Checker, vlint transmits your content to Nu Html Checker.

    3. Run vlint

      # html
      # HTML files (extension is either .htm, .html, or .shtml) will be checked.
      npx vlint
      
      # css
      # CSS files (extension is .css) will be checked.
      npx vlint --css

    Configuring

    vlint can be configured from a .vlintrc.yml.

    html:
        vnu: https://example.com/
        validator: https://example.com/w3c-validator/check
        charset: utf-8
        include: '**/*.+(htm|html|shtml)'
        ignore:
            - '**/node_modules/**'
    css:
        vnu: https://example.com/
        charset: utf-8
        include: '**/*.css'
        ignore:
            - '**/node_modules/**'
    • vnu

      URL of Nu Html Checker

      Default: no default value. This must be specified.

    • validator

      URL of W3C Markup Validator. If this option was specified, XHTML 1.0, HTML 4.01 and so on are validated by W3C Markup Validator.

      HTML files which are not supported by W3C Markup Validator are validated by Nu Html Checker even if this option was specified.

      Specifying this option for css has no effect. CSS files are validated by Nu Html Checker even if this option was specified.

      Default: no default value.

    • charset

      Encoding (charset) of the file. If this option was omitted, Nu Html Checker detects encoding automatically.

      Default: no default value.

    • include

      glob pattern of HTML or CSS. This can be a string or an array of string.

      Default: **/*.+(htm|html|shtml) (HTML) or **/*.css (CSS)

    • ignore

      glob pattern of files which ignored by vlint. This can be a string or an array of string.

      Default: [**/node_modules/**]

    Ignoring errors and warnings

    vlint ignores errors and warnings defined in .vlintignore.yml.

    You can generate or update the entire of .vlintignore.yml by running following commands:

    vlint --rebaseline
    vlint --css --rebaseline

    Also, you can update the specific parts of .vlintignore.yml by running following commands:

    vlint --update path/to/html
    vlint --css --update path/to/css

    Additionally, you can edit .vlintignore.yml manually.

    html:
        # glob pattern
        '**/*.html':
            # regular expression
            - 'Legacy encoding “.*” used\. Documents must use UTF-8\.'
            - 'The only allowed value for the “charset” attribute for the “meta” element is “utf-8”\.'
    css:
        # glob pattern
        path_to_css/styles.css:
            # regular expression
            - 'Warning: Document uses the Unicode Private Use Area\(s\), which should not be used in publicly exchanged documents\. \(Charmod C073\)'

    Change Log

    0.8.1

    • Made README.md use example.com in config examples
    • Updated dependencies

    0.8.0

    • Made filtering faster
    • Dropped Node.js 10 support
    • Added ability to display the number of files to be validated
    • Updated dependencies

    0.7.0

    • Restored Node.js 10 support
    • Fixed an issue that vlint escaped RegExp literals incorrectly
    • Replaced meow with cac to reduce package install size
    • Updated dependencies

    0.6.1

    • Fixed wrong calculation of basic authorization credentials
    • Updated dependencies

    0.6.0

    • Added basic authorization support
    • Updated dependencies

    0.5.0

    0.4.1

    • Removed test coverage information from npm package

    0.4.0

    • Added --update flag to support updating the specific part of .vlintignore.yml
    • Added support '.yml' extension for '.vlintrc' and '.vlintignore' (.vlintrc.yml and .vlintignore.yml)
    • Updated dependencies

    0.3.0

    • Escape more regexp meta characters
    • Fixed removing used patterns in .vlintignore.yaml

    0.2.0

    • Respect ignore option in pre-commit hook scenario
    • Updated dependencies

    0.1.0

    • Initial release

    Keywords

    none

    Install

    npm i @mitsue/vlint

    DownloadsWeekly Downloads

    642

    Version

    0.8.1

    License

    MIT

    Unpacked Size

    29.4 kB

    Total Files

    13

    Last publish

    Collaborators

    • mitsue