markdown ESLint

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown ESLint相关的知识,希望对你有一定的参考价值。

module.exports = {
	env: {
		browser: true,
		jquery: true,
		es6: true,
	},
	parserOptions: {
		sourceType: 'module',
	},
	plugins: [],
	rules: {
		// Enforce one true brace style
		'brace-style': 'error',
		// Require camel case names
		'camelcase': [
			'error',
			{
				properties: 'always',
			},
		],
		// Disallow or enforce trailing commas
		'comma-dangle': 'off',
		// Enforce spacing before and after comma
		'comma-spacing': 'error',
		// Enforce one true comma style
		'comma-style': ['error', 'last'],
		// Encourages use of dot notation whenever possible
		'dot-notation': [
			'error',
			{
				allowKeywords: true,
				allowPattern: '^[a-z]+(_[a-z]+)+$',
			},
		],
		// Enforce newline at the end of file, with no multiple empty lines
		'eol-last': 'error',
		// Require or disallow spacing between function identifiers and their invocations
		'func-call-spacing': 'off',
		// Enforces spacing between keys and values in object literal properties
		'key-spacing': [
			'error',
			{
				beforeColon: false,
				afterColon: true,
			},
		],
		// Enforce spacing before and after keywords
		'keyword-spacing': 'error',
		// Disallow mixed "LF" and "CRLF" as linebreaks
		'linebreak-style': ['error', 'unix'],
		// Disallow mixed spaces and tabs for indentation
		'no-mixed-spaces-and-tabs': 'error',
		// Disallow use of multiline strings
		'no-multi-str': 'error',
		// Disallow multiple empty lines
		'no-multiple-empty-lines': 'error',
		// Disallow use of the with statement
		'no-with': 'error',
		// Require or disallow an newline around variable declarations
		'one-var-declaration-per-line': ['error', 'initializations'],
		// Enforce operators to be placed before or after line breaks
		'operator-linebreak': 'off',
		// Require or disallow use of semicolons instead of ASI
		'semi': ['error', 'always'],
		// Require or disallow space before blocks
		'space-before-blocks': ['error', 'always'],
		// Require or disallow space before function opening parenthesis
		'space-before-function-paren': ['error', 'never'],
		// Requires to declare all vars on top of their containing scope
		'vars-on-top': 'error',
		'valid-typeof': 'error',
		'no-extra-parens': ['error', 'functions'],
	},
};
# ESLint
* https://eslint.org/
* v5.12.0 - 1-10-2019
* File format: https://eslint.org/docs/user-guide/configuring#configuration-file-formats
* Number rules: https://eslint.org/docs/user-guide/configuring#configuring-rules

## Setup
`npm install -g eslint`  

## Add to PATH
`C:\Users\{user_name}\AppData\Roaming\npm`  
`C:\Users\{user_name}\AppData\Roaming\npm\eslint`

以上是关于markdown ESLint的主要内容,如果未能解决你的问题,请参考以下文章

markdown Eslint没有projeto

markdown Eslint提示

markdown ESLint

markdown 允许您一起使用ESLint和Prettier的工具之间的比较。

markdown 使用ESLint和AirBnB样式指南规则配置Atom编辑器

ESLint 无法识别“@typescript-eslint/eslint-plugin”