🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

standard

Package Overview
Dependencies
Maintainers
16
Versions
185
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

standard - npm Package Compare versions

Comparing version

to
16.0.4

.pre-commit-hooks.yaml

24

AUTHORS.md

@@ -150,3 +150,27 @@ # Authors

- Shahar Or (mightyiam) ([mightyiampresence@gmail.com](mailto:mightyiampresence@gmail.com))
- にしくま ([graphic.extra005@gmail.com](mailto:graphic.extra005@gmail.com))
- Eric Berry ([coderberry@gmail.com](mailto:coderberry@gmail.com))
- Abdullah Alansari ([ahimta@gmail.com](mailto:ahimta@gmail.com))
- Adam Jones ([jones_adam@rocketmail.com](mailto:jones_adam@rocketmail.com))
- zhangyu ([zhangyu29@asiainfo.com](mailto:zhangyu29@asiainfo.com))
- Shahar Dawn Or ([mightyiampresence@gmail.com](mailto:mightyiampresence@gmail.com))
- Joshua Goran ([35858093+joshuagoran@users.noreply.github.com](mailto:35858093+joshuagoran@users.noreply.github.com))
- HCLonely ([h1606051253@gmail.com](mailto:h1606051253@gmail.com))
- Italo ([italoaurelior@gmail.com](mailto:italoaurelior@gmail.com))
- Vrq ([januszveiro@gmail.com](mailto:januszveiro@gmail.com))
- 王刚 ([wg0121@outlook.com](mailto:wg0121@outlook.com))
- Javier Mendoza ([37485620+javiermendozain@users.noreply.github.com](mailto:37485620+javiermendozain@users.noreply.github.com))
- Ciffelia ([mc.prince.0203@gmail.com](mailto:mc.prince.0203@gmail.com))
- Nacho Caiafa ([nachokai@outlook.com](mailto:nachokai@outlook.com))
- Tom Clark ([tom@octue.com](mailto:tom@octue.com))
- Septiana Yoga ([septianayoga30@gmail.com](mailto:septianayoga30@gmail.com))
- logustra ([logustra@outlook.com](mailto:logustra@outlook.com))
- Kid ([44045911+kidonng@users.noreply.github.com](mailto:44045911+kidonng@users.noreply.github.com))
- Aki ([71239005+AkiaCode@users.noreply.github.com](mailto:71239005+AkiaCode@users.noreply.github.com))
- HonkingGoose ([34918129+HonkingGoose@users.noreply.github.com](mailto:34918129+HonkingGoose@users.noreply.github.com))
- Alex Grover ([hello@alexgrover.me](mailto:hello@alexgrover.me))
- Todd Bluhm ([toddbluhm@gmail.com](mailto:toddbluhm@gmail.com))
- alanclarke ([alan@qubit.com](mailto:alan@qubit.com))
- Csaba Maulis ([csaba@om4.com.au](mailto:csaba@om4.com.au))
#### Generated by tools/update-authors.sh.

5

bin/cmd.js
#!/usr/bin/env node
/* eslint-disable no-var */

@@ -7,6 +8,6 @@ var match = process.version.match(/v(\d+)\.(\d+)/)

if (major >= 9 || (major === 8 && minor >= 10)) {
if (major >= 11 || (major === 10 && minor >= 12)) {
require('standard-engine').cli(require('../options'))
} else {
console.error('standard: Node 8.10.0 or greater is required. `standard` did not run.')
console.error('standard: Node 10.12.0 or greater is required. `standard` did not run.')
}

1

index.js

@@ -0,1 +1,2 @@

/*! standard. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
const Linter = require('standard-engine').linter

@@ -2,0 +3,0 @@ const opts = require('./options')

{
"name": "standard",
"description": "JavaScript Standard Style",
"version": "14.3.4",
"version": "16.0.4",
"author": {
"name": "Feross Aboukhadijeh",
"email": "feross@feross.org",
"name": "Feross Aboukhadijeh",
"url": "https://feross.org/"
"url": "https://feross.org"
},
"bin": "./bin/cmd.js",
"bin": {
"standard": "bin/cmd.js"
},
"bugs": {

@@ -15,25 +17,22 @@ "url": "https://github.com/standard/standard/issues"

"dependencies": {
"eslint": "~6.8.0",
"eslint-config-standard": "14.1.1",
"eslint-config-standard-jsx": "8.1.0",
"eslint-plugin-import": "~2.18.0",
"eslint-plugin-node": "~10.0.0",
"eslint-plugin-promise": "~4.2.1",
"eslint-plugin-react": "~7.14.2",
"eslint-plugin-standard": "~4.0.0",
"standard-engine": "^12.0.0"
"eslint": "~7.18.0",
"eslint-config-standard": "16.0.3",
"eslint-config-standard-jsx": "10.0.0",
"eslint-plugin-import": "~2.24.2",
"eslint-plugin-node": "~11.1.0",
"eslint-plugin-promise": "~5.1.0",
"eslint-plugin-react": "~7.25.1",
"standard-engine": "^14.0.1"
},
"devDependencies": {
"babel-eslint": "^10.0.3",
"cross-spawn": "^7.0.0",
"eslint-index": "^1.3.0",
"hallmark": "^2.0.0",
"minimist": "^1.2.2",
"mkdirp": "^1.0.3",
"run-parallel-limit": "^1.0.3",
"standard-packages": "^3.6.1",
"tape": "^4.6.0"
"cross-spawn": "^7.0.3",
"hallmark": "^3.1.0",
"minimist": "^1.2.5",
"run-parallel-limit": "^1.1.0",
"run-series": "^1.1.9",
"simple-get": "^4.0.0",
"tape": "^5.3.1"
},
"engines": {
"node": ">=8.10.0"
"node": ">=10.12.0"
},

@@ -73,8 +72,21 @@ "homepage": "https://standardjs.com",

"scripts": {
"show-rules": "eslint-index eslintrc.json",
"show-rules-disabled": "eslint-index eslintrc.json --status omitted off",
"show-summary": "eslint-index eslintrc.json --format table",
"test": "./bin/cmd.js --verbose && tape test/*.js",
"test": "npm run test-internal && npm run test-external",
"test-internal": "./bin/cmd.js --verbose && tape test/*.js",
"test-external": "tape test/external/*.js",
"update-authors": "./tools/update-authors.sh && hallmark --fix AUTHORS.md"
}
},
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
]
}

@@ -11,3 +11,5 @@ <h1 align="center">

<a href="https://discord.gg/ZegqCBr"><img src="https://img.shields.io/discord/612704110008991783" alt="discord"></a>
<a href="https://travis-ci.org/standard/standard"><img src="https://img.shields.io/travis/standard/standard/master.svg" alt="travis"></a>
<a href="https://github.com/standard/standard/actions/workflows/test-external.yml"><img src="https://github.com/standard/standard/actions/workflows/test-external.yml/badge.svg?branch=master" alt="External tests"></a>
<a href="https://github.com/standard/standard/actions/workflows/test-internal.yml"><img src="https://github.com/standard/standard/actions/workflows/test-internal.yml/badge.svg?branch=master" alt="Internal tests"></a>
<a href="https://github.com/standard/standard/actions?query=workflow%3A%22Old+test%22"><img src="https://github.com/standard/standard/workflows/Old%20test/badge.svg" alt="status badge old Node test"></a>
<a href="https://www.npmjs.com/package/standard"><img src="https://img.shields.io/npm/v/standard.svg" alt="npm version"></a>

@@ -18,2 +20,6 @@ <a href="https://www.npmjs.com/package/eslint-config-standard"><img src="https://img.shields.io/npm/dm/eslint-config-standard.svg" alt="npm downloads"></a>

<h5 align="center">
Sponsored by&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://wormhole.app/?utm_medium=sponsorship&utm_source=standard&utm_campaign=feross"><img src="https://cdn.rawgit.com/standard/standard/master/docs/logos/wormhole.png" alt="Wormhole" height=50 valign="middle"></a>
</h5>
<p align="center">

@@ -23,2 +29,3 @@ <a href="/docs/README-en.md">English</a> •

<a href="/docs/README-fr.md">Français</a> •
<a href="/docs/README-id.md">Bahasa Indonesia</a> •
<a href="/docs/README-iteu.md">Italiano (Italian)</a> •

@@ -60,3 +67,3 @@ <a href="/docs/README-ja.md">日本語 (Japanese)</a> •

- [How do I ignore files?](#how-do-i-ignore-files)
- [How do I hide a certain warning?](#how-do-i-hide-a-certain-warning)
- [How do I disable a rule?](#how-do-i-disable-a-rule)
- [I use a library that pollutes the global namespace. How do I prevent "variable is not defined" errors?](#i-use-a-library-that-pollutes-the-global-namespace-how-do-i-prevent-variable-is-not-defined-errors)

@@ -67,2 +74,3 @@ - [How do I use experimental JavaScript (ES Next) features?](#how-do-i-use-experimental-javascript-es-next-features)

- [What about Web Workers and Service Workers?](#what-about-web-workers-and-service-workers)
- [What is the difference between warnings and errors?](#what-is-the-difference-between-warnings-and-errors)
- [Can I check code inside of Markdown or HTML files?](#can-i-check-code-inside-of-markdown-or-html-files)

@@ -73,3 +81,2 @@ - [Is there a Git `pre-commit` hook?](#is-there-a-git-pre-commit-hook)

- [How do I contribute to StandardJS?](#how-do-i-contribute-to-standardjs)
- [License](#license)

@@ -126,21 +133,21 @@ ## Install

```json
{
"name": "my-cool-package",
"devDependencies": {
"standard": "*"
},
"scripts": {
"test": "standard && node my-tests.js"
}
}
```
```json
{
"name": "my-cool-package",
"devDependencies": {
"standard": "*"
},
"scripts": {
"test": "standard && node my-tests.js"
}
}
```
2. Style is checked automatically when you run `npm test`
```bash
$ npm test
Error: Use JavaScript Standard Style
lib/torrent.js:950:11: Expected '===' and instead saw '=='.
```
```bash
$ npm test
Error: Use JavaScript Standard Style
lib/torrent.js:950:11: Expected '===' and instead saw '=='.
```

@@ -177,9 +184,9 @@ 3. Never give style feedback on a pull request again!

[<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/nodejs.png>](https://nodejs.org) | [<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/npm.png>](https://www.npmjs.com) | [<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/github.png>](https://github.com) | [<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/elastic.png>](https://www.elastic.co) |
[<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/nodejs.png>](https://nodejs.org) | [<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/npm.png>](https://www.npmjs.com) | [<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/github.png>](https://github.com) | [<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/wormhole.png>](https://wormhole.app) |
|---|---|---|---|
[<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/express.png>](http://expressjs.com) | [<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/electron.png>](http://electron.atom.io) | [<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/nuxtjs.png>](https://nuxtjs.org/) | [<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/atom.png>](https://atom.io) |
[<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/express.png>](http://expressjs.com) | [<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/electron.png>](http://electron.atom.io) | [<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/nuxtjs.png>](https://nuxtjs.org/) | [<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/elastic.png>](https://www.elastic.co) |
|---|---|---|---|
| [<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/mongodb.jpg>](https://www.mongodb.com) | [<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/zendesk.png>](https://www.zendesk.com) | [<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/brave.png>](https://www.brave.com) | [<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/zeit.png>](https://zeit.co) |
| [<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/mongodb.jpg>](https://www.mongodb.com) | [<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/zendesk.png>](https://www.zendesk.com) | [<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/brave.png>](https://www.brave.com) | [<img width=190 src=https://assets.vercel.com/image/upload/v1621541666/front/assets/logotype-black-on-white.png>](https://vercel.com) |
|---|---|---|---|

@@ -216,3 +223,3 @@

| [<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/swissdev-js-jobs.png>](https://swissdevjobs.ch/jobs/JavaScript/All) | Your logo here | Your logo here | Your logo here |
| [<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/jublia.png>](https://jublia.com/) | [<img width=190 src=https://cdn.rawgit.com/standard/standard/master/docs/logos/atom.png>](https://atom.io) | Your logo here | Your logo here |
|---|---|---|---|

@@ -264,9 +271,9 @@

Install **[vscode-standardjs][vscode-1]**. (Includes support for automatic formatting.)
Install **[vscode-standard][vscode-1]**. (Includes support for automatic formatting.)
For JS snippets, install: **[vscode-standardjs-snippets][vscode-2]**. For React snippets, install **[vscode-react-standard][vscode-3]**.
[vscode-1]: https://marketplace.visualstudio.com/items/chenxsan.vscode-standardjs
[vscode-1]: https://marketplace.visualstudio.com/items?itemName=standard.vscode-standard
[vscode-2]: https://marketplace.visualstudio.com/items?itemName=capaj.vscode-standardjs-snippets
[vscode-3]: https://marketplace.visualstudio.com/items/TimonVS.ReactSnippetsStandard
[vscode-3]: https://marketplace.visualstudio.com/items?itemName=TimonVS.ReactSnippetsStandard

@@ -388,3 +395,3 @@ ### Vim

Certain paths (`node_modules/`, `coverage/`, `vendor/`, `*.min.js`, `bundle.js`,
Certain paths (`node_modules/`, `coverage/`, `vendor/`, `*.min.js`,
and files/folders that begin with `.` like `.git/`) are automatically ignored.

@@ -408,9 +415,9 @@

## How do I hide a certain warning?
## How do I disable a rule?
In rare cases, you'll need to break a rule and hide the warning generated by
In rare cases, you'll need to break a rule and hide the error generated by
`standard`.
JavaScript Standard Style uses [ESLint](http://eslint.org/) under-the-hood and
you can hide warnings as you normally would if you used ESLint directly.
you can hide errors as you normally would if you used ESLint directly.

@@ -493,3 +500,3 @@ To get verbose output (so you can find the particular rule name to ignore), run:

```bash
npm install babel-eslint --save-dev
npm install @babel/eslint-parser --save-dev
```

@@ -500,3 +507,3 @@

```bash
$ standard --parser babel-eslint
$ standard --parser @babel/eslint-parser
```

@@ -509,3 +516,3 @@

"standard": {
"parser": "babel-eslint"
"parser": "@babel/eslint-parser"
}

@@ -520,19 +527,24 @@ }

To support JavaScript language variants, `standard` supports specifying a custom JavaScript
For TypeScript, an official variant `ts-standard` is supported and maintained that provides a very
similar experience to `standard`.
For other JavaScript language variants, `standard` supports specifying a custom JavaScript
parser as well as an ESLint plugin to handle the changed syntax. Before using a JavaScript
language variant, consider whether the added complexity is worth it.
### Flow
### TypeScript
To use Flow, you need to run `standard` with `babel-eslint` as the parser and
`eslint-plugin-flowtype` as a plugin.
[`ts-standard`](https://github.com/standard/ts-standard) is the officially supported variant for
TypeScript. `ts-standard` supports all the same rules and options as `standard` and includes
additional TypeScript specific rules. `ts-standard` will even lint regular `javascript` files
by setting the configuration in `tsconfig.json`.
```bash
npm install babel-eslint eslint-plugin-flowtype --save-dev
npm install ts-standard --save-dev
```
Then run:
Then run (where `tsconfig.json` is located in the working directory):
```bash
$ standard --parser babel-eslint --plugin flowtype
$ ts-standard
```

@@ -544,5 +556,4 @@

{
"standard": {
"parser": "babel-eslint",
"plugins": [ "flowtype" ]
"ts-standard": {
"project": "./tsconfig.json"
}

@@ -552,17 +563,15 @@ }

*Note: `plugin` and `plugins` are equivalent.*
*Note: To include additional files in linting such as test files, create a `tsconfig.eslint.json` file to use instead.*
### TypeScript
If you really want to configure hundreds of ESLint rules individually, you can always use eslint
directly with [`eslint-config-standard-with-typescript`](https://github.com/standard/eslint-config-standard-with-typescript)
to layer your changes on top.
To use TypeScript, you need to run `standard` with `@typescript-eslint/parser` as the parser,
`@typescript-eslint/eslint-plugin` as a plugin, and tell standard to lint `**/*.ts` files (since it
doesn't by default).
### Flow
Unfortunately, there's an outstanding [issue](https://github.com/standard/standard/issues/1283)
with `standard` and Typescript where `standard` would incorrectly emit unused-variable errors
(e.g: when you import interfaces). And as a workaround, you need to use
[standardx](https://github.com/standard/standardx) instead:sweat_smile:.
To use Flow, you need to run `standard` with `@babel/eslint-parser` as the parser and
`eslint-plugin-flowtype` as a plugin.
```bash
npm install standardx @typescript-eslint/parser @typescript-eslint/eslint-plugin --save-dev
npm install @babel/eslint-parser eslint-plugin-flowtype --save-dev
```

@@ -573,3 +582,3 @@

```bash
$ standardx --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin **/*.ts
$ standard --parser @babel/eslint-parser --plugin flowtype
```

@@ -581,11 +590,5 @@

{
"eslintConfig": {
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error"
}
},
"standardx": {
"parser": "@typescript-eslint/parser",
"plugins": [ "@typescript-eslint/eslint-plugin" ]
"standard": {
"parser": "@babel/eslint-parser",
"plugins": [ "flowtype" ]
}

@@ -595,15 +598,4 @@ }

With that in `package.json`, you can run:
*Note: `plugin` and `plugins` are equivalent.*
```bash
standardx **/*.ts
```
And you probably should remove `standard` too to avoid confusion where it's used by mistake
instead of `standardx`.
```bash
npm uninstall standard
```
## What about Mocha, Jest, Jasmine, QUnit, etc?

@@ -650,2 +642,25 @@

## What is the difference between warnings and errors?
`standard` treats all rule violations as errors, which means that `standard`
will exit with a non-zero (error) exit code.
However, we may occasionally release a new major version of `standard`
which changes a rule that affects the majority of `standard` users (for example,
transitioning from `var` to `let`/`const`). We do this only when we think the
advantage is worth the cost and only when the rule is
[auto-fixable](#is-there-an-automatic-formatter).
In these situations, we have a "transition period" where the rule change is only
a "warning". Warnings don't cause `standard` to return a non-zero (error)
exit code. However, a warning message will still print to the console. During
the transition period, `using standard --fix` will update your code so that it's
ready for the next major version.
The slow and careful approach is what we strive for with `standard`. We're
generally extremely conservative in enforcing the usage of new language
features. We want using `standard` to be light and fun and so we're careful
about making changes that may get in your way. As always, you can
[disable a rule](#how-do-i-disable-a-rule) at any time, if necessary.
## Can I check code inside of Markdown or HTML files?

@@ -684,4 +699,9 @@

Funny you should ask!
Yes! Hooks are great for ensuring that unstyled code never even makes it into your repo.
Never give style feedback on a pull request again!
You even have a choice...
### Install your own hook
```bash

@@ -695,3 +715,3 @@ #!/bin/bash

if IFS= read -r -d $'\n' path; then
{ echo "$path"; cat; } | xargs $@
echo "$path" | cat - | xargs "$@"
fi

@@ -706,2 +726,28 @@ }

### Use a `pre-commit` hook
The [pre-commit](https://pre-commit.com/) library allows hooks to be declared within a `.pre-commit-config.yaml` configuration file in the repo, and therefore more easily maintained across a team.
Users of pre-commit can simply add `standard` to their `.pre-commit-config.yaml` file, which will automatically fix `.js`, `.jsx`, `.ts`, `.tsx`, `.mjs` and `.cjs` files:
```yaml
- repo: https://github.com/standard/standard
rev: master
hooks:
- id: standard
```
Alternatively, for more advanced styling configurations, use `standard` within the [eslint hook](https://github.com/pre-commit/mirrors-eslint):
```yaml
- repo: https://github.com/pre-commit/mirrors-eslint
rev: master
hooks:
- id: eslint
files: \.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx
types: [file]
additional_dependencies:
- eslint@latest
- eslint-config-standard@latest
# and whatever other plugins...
```
## How do I make the output all colorful and pretty?

@@ -743,3 +789,3 @@

envs: [], // custom eslint environment
parser: '' // custom js parser (e.g. babel-eslint)
parser: '' // custom js parser (e.g. @babel/eslint-parser)
}

@@ -790,3 +836,3 @@ ```

envs: [], // eslint environment
parser: '' // js parser (e.g. babel-eslint)
parser: '' // js parser (e.g. @babel/eslint-parser)
}

@@ -809,3 +855,2 @@ ```

- **[eslint-config-standard-jsx](https://github.com/standard/eslint-config-standard-jsx)** - eslint rules for standard (JSX)
- **[eslint-plugin-standard](https://github.com/standard/eslint-plugin-standard)** - custom eslint rules for standard (not part of eslint core)
- **[eslint](https://github.com/eslint/eslint)** - the linter that powers standard

@@ -812,0 +857,0 @@ - **[snazzy](https://github.com/standard/snazzy)** - pretty terminal output for standard

@@ -7,2 +7,3 @@ # JavaScript Standard Style

<a href="/docs/RULES-fr.md">Français</a> •
<a href="/docs/RULES-id.md">Bahasa Indonesia</a> •
<a href="/docs/RULES-iteu.md">Italiano (Italian)</a> •

@@ -224,4 +225,4 @@ <a href="/docs/RULES-ja.md">日本語 (Japanese)</a> •

var value = 'hello world'
// blank line
// blank line
console.log(value)

@@ -419,3 +420,3 @@ ```

}
class Dog extends Animal {

@@ -422,0 +423,0 @@ constructor () { // ✗ avoid

Sorry, the diff of this file is too big to display