UNPKG

3.97 kBMarkdownView Raw
1# video.js Standard Style
2
3[![travis][travis-image]][travis-url]
4[![npm][npm-image]][npm-url]
5[![downloads][downloads-image]][downloads-url]
6
7This module provides a hands-off wrapper around ESLint and the video.js organization's [shared ESLint config][config]. It checks ("lints") your code to verify that it complies with our organization's agreed-upon standards.
8
9## Install
10
11```bash
12npm install videojs-standard
13```
14
15Or, if you prefer to install it globally:
16
17```bash
18npm install -g videojs-standard
19```
20
21This will put the `vjsstandard` program on your PATH, meaning you can call it from anywhere and it'll run.
22
23## Usage
24
25> If you are using [our plugin generator][generator], you will already have videojs-standard available within your project! Running `npm run lint` will run your plugin project through videojs-standard!
26
27The simplest use case would be checking the style of all JavaScript files in the current working directory:
28
29```
30$ vjsstandard
31~/dev/my-code/src/index.js
32 527:1 warning Line 527 exceeds the maximum line length of 90 max-len
33```
34
35### Arguments
36
37`vjsstandard` will accept any number of file identifier arguments. These can be [glob][glob] patterns. Some examples:
38
39```bash
40$ vjsstandard foo.js src/**/*.js
41```
42
43If _not_ provided, `vjsstandard` will recursively check all JavaScript source files in the current working directory.
44
45### Options
46
47#### `-e`/`--errors`
48
49Produces a report that only includes errors; not warnings.
50
51#### `-w`/`--warnings`
52
53Produces a report that only includes warnings; not errors.
54
55#### `--format`
56
57Instead of producing a report on the errors and warnings found in files, this will attempt to use ESLint's auto-formatting capabilities to overwrite existing files to resolve rules violations.
58
59#### `--help`
60
61Outputs help on using videojs-standard.
62
63#### `--version`
64
65Outputs the version number of videojs-standard.
66
67### Ignoring Files
68
69Sometimes you need to ignore files because they represent preprocessed or minified assets, which are not appropriate for linting.
70
71File [glob][glob] patterns can be ignored by adding them to your project's `package.json` as a part of a `vjsstandard.ignore` array:
72
73```json
74{
75 "vjsstandard": {
76 "ignore": [
77 "**/dist/**",
78 "Gulpfile.js"
79 ]
80 }
81}
82```
83
84## Contributing
85
86This project should almost never change.
87
88A rule should only change if there is a _very_ compelling reason that the video.js core contributors have agreed upon by discussion.
89
90### Versioning Guidelines
91
92Because this project can cause builds to fail, we want to avoid any potentially breaking changes outside of major versions. Because this project is mostly a collection of dependencies, any change to those dependencies will require a version change in this project equal to the highest version change in dependencies.
93
94- A dependency being updated by a major version will be a **major** version of videojs-standard.
95- A dependency being updated by a minor version will be a **minor** version of videojs-standard.
96- A dependency being updated by a patch version will be a **patch** version of videojs-standard.
97
98Combined with the rules outlined [in eslint-config-videojs][config], this should allow common version ranges (`~` and `^`) to _never_ introduce a change that could break someone's build due to linter errors!
99
100## License
101
102Apache-2.0. Copyright (c) [Brightcove, Inc.][bcov]
103
104[bcov]: https://www.brightcove.com/
105[config]: https://github.com/videojs/eslint-config-videojs
106[downloads-image]: https://img.shields.io/npm/dm/videojs-standard.svg?style=flat
107[downloads-url]: https://npmjs.org/package/videojs-standard
108[generator]: https://github.com/videojs/generator-videojs-plugin
109[glob]: https://www.npmjs.com/package/glob
110[npm-image]: https://img.shields.io/npm/v/videojs-standard.svg?style=flat
111[npm-url]: https://npmjs.org/package/videojs-standard
112[travis-image]: https://img.shields.io/travis/videojs/standard.svg?style=flat
113[travis-url]: https://travis-ci.org/videojs/standard