0.5.6 • Published 9 months ago

eslint-plugin-userscripts v0.5.6

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

eslint-plugin-userscripts

Implements rules for userscripts in eslint.

Installation

You'll first need to install ESLint:

npm install eslint --save-dev

Next, install eslint-plugin-userscripts:

npm install eslint-plugin-userscripts --save-dev

Usage in legacy config

Add userscripts to the plugins section of your .eslintrc configuration file:

{
  "extends": ["plugin:userscripts/recommended"]
}

Usage in recent flat config

Add an element to the config array in your eslint.config.* file :

const userscripts = require('eslint-plugin-userscripts');

module.exports = [
  // other configs
  {
    files: ['*.user.js'],
    plugins: {
      userscripts: {
        rules: userscripts.rules
      }
    },
    rules: {
      ...userscripts.configs.recommended.rules
    },
    settings: {
      userscriptVersions: {
        violentmonkey: '*'
      }
    }
  }
];

Supported Rules

RuleDescriptionRecommended
filename-userEnsures userscripts end with .user.js
no-invalid-grantEnsures the argument passed to @grant is valid
no-invalid-metadataEnsures userscripts have valid metadata
require-nameEnsures userscripts have a name
require-descriptionEnsures userscripts have a description
require-versionEnsures userscripts have a valid version
use-homepage-and-urlEnsures that for each homepage attribute, homepageURL is also used
require-download-urlEnsures that for each downloadURL there is a updateURL
align-attributesEnsures that attributes are spaced out and aligned
require-attribute-space-prefixEnsure that attributes are prefixed by one space
metadata-spacingEnsures there is a newline between the metadata and the code
no-invalid-headersEnsures userscripts have valid headers
compat-grantEnsures your @grant permissions are supported
compat-headersEnsures your headers are supported
better-use-matchPrefers @match over @include
0.5.6

9 months ago

0.5.5

11 months ago

0.5.4

11 months ago

0.5.3

1 year ago

0.5.2

1 year ago

0.5.1

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.2.13

2 years ago

0.3.0

2 years ago

0.2.12

2 years ago

0.2.11

2 years ago

0.2.10

3 years ago

0.2.9

3 years ago

0.2.7

3 years ago

0.2.8

3 years ago

0.2.6

3 years ago

0.2.5

3 years ago

0.2.4

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

4 years ago

0.1.0

4 years ago

0.1.1

4 years ago

0.0.3

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago