standard
standard documentation
- Version in MegaLinter: 15.0.1
- Visit Official Web Site
- See Index of problems detected by standard
Configuration in MegaLinter
- Enable standard by adding
TYPESCRIPT_STANDARD
in ENABLE_LINTERS variable - Disable standard by adding
TYPESCRIPT_STANDARD
in DISABLE_LINTERS variable
- Enable auto-fixes by adding
TYPESCRIPT_STANDARD
in APPLY_FIXES variable
Variable | Description | Default value |
---|---|---|
JAVASCRIPT_DEFAULT_STYLE | For standard to be active, JAVASCRIPT_DEFAULT_STYLE must be standard |
standard |
TYPESCRIPT_STANDARD_ARGUMENTS | User custom arguments to add in linter CLI call Ex: -s --foo "bar" |
|
TYPESCRIPT_STANDARD_FILTER_REGEX_INCLUDE | Custom regex including filter Ex: (src\|lib) |
Include every file |
TYPESCRIPT_STANDARD_FILTER_REGEX_EXCLUDE | Custom regex excluding filter Ex: (test\|examples) |
Exclude no file |
TYPESCRIPT_STANDARD_CLI_LINT_MODE | Override default CLI lint mode - file : Calls the linter for each file- list_of_files : Call the linter with the list of files as argument- project : Call the linter from the root of the project |
list_of_files |
TYPESCRIPT_STANDARD_FILE_EXTENSIONS | Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all filesEx: [".py", ""] |
[".ts"] |
TYPESCRIPT_STANDARD_FILE_NAMES_REGEX | File name regex filters. Regular expression list for filtering files by their base names using regex full match. Empty list includes all files Ex: ["Dockerfile(-.+)?", "Jenkinsfile"] |
Include every file |
TYPESCRIPT_STANDARD_PRE_COMMANDS | List of bash commands to run before the linter | None |
TYPESCRIPT_STANDARD_POST_COMMANDS | List of bash commands to run after the linter | None |
TYPESCRIPT_STANDARD_DISABLE_ERRORS | Run linter but consider errors as warnings | false |
TYPESCRIPT_STANDARD_DISABLE_ERRORS_IF_LESS_THAN | Maximum number of errors allowed | 0 |
IDE Integration
Use standard in your favorite IDE to catch errors before MegaLinter !
MegaLinter Flavours
This linter is available in the following flavours
Flavor | Description | Embedded linters | Info | |
---|---|---|---|---|
all | Default MegaLinter Flavor | 97 | ||
javascript | Optimized for JAVASCRIPT or TYPESCRIPT based projects | 50 |
Behind the scenes
How are identified applicable files
- File extensions:
.ts
How the linting is performed
- standard is called once with the list of files as arguments
Example calls
standard --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin myfile.ts
standard --parser @typescript-eslint/parser --plugin @typescript-eslint/eslint-plugin --fix myfile.ts
Help content
standard - Use JavaScript Standard Style (https://standardjs.com)
Usage:
standard <flags> [FILES...]
If FILES is omitted, all JavaScript source files (*.js, *.jsx, *.mjs, *.cjs)
in the current working directory are checked, recursively.
Certain paths (node_modules/, coverage/, vendor/, *.min.js, bundle.js, and
files/folders that begin with '.' like .git/) are automatically ignored.
Paths in a project's root .gitignore file are also automatically ignored.
Flags:
--fix Automatically fix problems
-v, --verbose Show rule names for errors (to ignore specific rules)
--version Show current version
-h, --help Show usage information
Flags (advanced):
--stdin Read file text from stdin
--global Declare global variable
--plugin Use custom eslint plugin
--env Use custom eslint environment
--parser Use custom js parser (e.g. babel-eslint)
Installation on mega-linter Docker image
- NPM packages (node.js):
Example success log
Results of standard linter (version 15.0.1)
See documentation on https://megalinter.github.io/descriptors/typescript_standard/
-----------------------------------------------
[SUCCESS] .automation/test/typescript/typescript_good_1.ts
Example error log
Results of standard linter (version 15.0.1)
See documentation on https://megalinter.github.io/descriptors/typescript_standard/
-----------------------------------------------
[ERROR] .automation/test/typescript/typescript_bad_1.ts
standard: Use JavaScript Standard Style (https://standardjs.com)
.automation/test/typescript/typescript_bad_1.ts:5:39: Parsing error: Unterminated regular expression literal.