![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
standard-engine
Advanced tools
Changelog
3.1.1 - 2016-02-03
win-spawn
dev dependency with cross-spawn-async
.Readme
Wrap your own eslint rules in a easy-to-use command line tool and/or a JS module.
npm install standard-engine
standard-engine
?Here is a list of packages using standard-engine
. Dive into them for ideas!
standard
with semicolons sprinkled on top.Did you make your own? Create a pull request and we will add it to the README!
Create the files below and fill in your own values for options.js
.
index.js
// programmatic usage
var Linter = require('standard-engine').linter
var opts = require('./options.js')
module.exports = new Linter(opts)
cli.js
#!/usr/bin/env node
var opts = require('../options.js')
require('standard-engine').cli(opts)
options.js
var eslint = require('eslint')
var path = require('path')
var pkg = require('./package.json')
module.exports = {
// homepage, version and bugs pulled from package.json
eslint: eslint, // pass any version of eslint >= 1.0.0
cmd: 'pocketlint', // should match the "bin" key in your package.json
version: pkg.version,
homepage: pkg.homepage,
bugs: pkg.bugs.url,
tagline: 'Live by your own standards!', // displayed in output --help
eslintConfig: {
configFile: path.join(__dirname, 'eslintrc.json')
},
// These are optional. If included, the --format option will be made available
formatter: require('pocketlint-format'), // note you'll have to create this :)
formatterName: 'pocketlint-format'
}
eslintrc.json Put all your .eslintrc rules in this file. A good practice is to create an ESLint Shareable Config and extend it, but its not required:
{
// pretend that the package eslint-config-pocketlint exists!
"extends": ["pocketlint"]
}
Take a look at eslint-config-standard as an example, or if you want to extend/mutate standard
, see eslint-config-semistandard.
The paths node_modules/**
, *.min.js
, bundle.js
, coverage/**
, hidden files/folders
(beginning with .
), and all patterns in a project's root .gitignore
file are
automatically ignored.
Sometimes you need to ignore additional folders or specific minfied files. To do that, add
a ignore
property to package.json
:
"pocketlint": { // this key should equal the value of cmd in options.js
"ignore": [
"**/out/",
"/lib/select2/",
"/lib/ckeditor/",
"tmp.js"
]
}
Since standard-engine
uses eslint
under-the-hood, you can
hide warnings as you normally would if you used eslint
directly.
To get verbose output (so you can find the particular rule name to ignore), run:
$ pocketlint --verbose
Error: Live by your own standards!
routes/error.js:20:36: 'file' was used before it was defined. (no-use-before-define)
Disable all rules on a specific line:
file = 'I know what I am doing' // eslint-disable-line
Or, disable only the "no-use-before-define"
rule:
file = 'I know what I am doing' // eslint-disable-line no-use-before-define
Or, disable the "no-use-before-define"
rule for multiple lines:
/*eslint-disable no-use-before-define */
// offending code here...
// offending code here...
// offending code here...
/*eslint-enable no-use-before-define */
package.json
standard-engine
will also look in a project's package.json
and respect any global variables defined like so:
{
"pocketlint": { // this key should equal the value of cmd in options.js
"global": [ "myVar1", "myVar2" ]
}
}
standard-engine
supports custom JS parsers. To use a custom parser, install it from npm
(example: npm install babel-eslint
) and add this to your package.json
:
{
"pocketlint": { // this key should equal the value of cmd in your options.js
"parser": "babel-eslint"
}
}
If you're using your custom linter globally (you installed it with -g
), then you also need to
install babel-eslint
globally with npm install babel-eslint -g
.
standardEngine.lintText(text, [opts], callback)
Lint the provided source text
to enforce your defined style. An opts
object may
be provided:
{
globals: [], // global variables to declare
parser: '' // custom js parser (e.g. babel-eslint)
}
The callback
will be called with an Error
and results
object:
{
results: [
{
filePath: '',
messages: [
{ ruleId: '', message: '', line: 0, column: 0 }
],
errorCount: 0,
warningCount: 0
}
],
errorCount: 0,
warningCount: 0
}
standardEngine.lintFiles(files, [opts], callback)
Lint the provided files
globs. An opts
object may be provided:
{
globals: [], // global variables to declare
parser: '', // custom js parser (e.g. babel-eslint)
ignore: [], // file globs to ignore (has sane defaults)
cwd: '' // current working directory (default: process.cwd())
}
The callback
will be called with an Error
and results
object (same as above).
FAQs
Wrap your standards in a tortilla and cover it in special sauce.
The npm package standard-engine receives a total of 341,464 weekly downloads. As such, standard-engine popularity was classified as popular.
We found that standard-engine demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 14 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.