当前位置:网站首页>.eslintrc.js configuration description
.eslintrc.js configuration description
2022-07-26 12:17:00 【Front end worker】
Rule level
"off" perhaps 0, Don't enable this rule
"warn" perhaps 1, There will be a warning if there is a problem
"error" perhaps 2, Errors will be reported in case of problems
close ESLint testing
/* eslint-disable */
console.log('hello world');
/* eslint-enable */
To configure eslintrc.js
module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint',
sourceType: 'module'
},
env: {
browser: true,
node: true,
es6: true
},
extends: ['plugin:vue/recommended', 'eslint:recommended'],
// add your custom rules here
// it is base on https://github.com/vuejs/eslint-config-vue
rules: {
'vue/max-attributes-per-line': [2, {
'singleline': 10,
'multiline': {
'max': 1,
'allowFirstLine': false
}
}],
'vue/html-self-closing': ['error', {
'html': {
'void': 'any',
'normal': 'any',
'component': 'any'
},
'svg': 'any',
'math': 'any'
}],
'vue/singleline-html-element-content-newline': 'off',
'vue/no-parsing-error': [2, {
'invalid-first-character-of-tag-name': false }],
'vue/no-use-v-if-with-v-for': 'off',
'vue/multiline-html-element-content-newline': 'off',
'vue/name-property-casing': [0, 'PascalCase'],
'vue/html-closing-bracket-newline': [0, {
'singleline': 'never',
'multiline': 'always'
}],
'vue/no-side-effects-in-computed-properties': 0,
'accessor-pairs': 2, // Use in objects getter/setter
'arrow-spacing': [2, {
'before': true,
'after': true
}], //=> Before / Back brackets
'block-spacing': [2, 'always'], // Whether the block needs spaces
// if while function hinder { Must be with if On the same line ,java style .
'brace-style': [2, '1tbs', {
'allowSingleLine': true
}],
// Name the hump by force
'camelcase': [0, {
'properties': 'always'
}],
// Array and object key value pairs last comma , never Parameters : No comma at the end , always Parameters : Must have a comma at the end ,
// always-multiline: Multiline mode must have commas , Single line mode cannot have comma
'comma-dangle': [2, 'never'],
// Controls the space before and after commas
'comma-spacing': [2, {
'before': false,
'after': true
}],
'comma-style': [2, 'last'], // Controls whether commas appear at the end of a line or at the beginning of a line
// Force to use... In subclass constructors super() Call parent constructor ,TypeScrip The compiler will also prompt
'constructor-super': 2,
// mandatory object.key in . The location of , Parameters :
// property,'.' The number should be on the same line as the attribute
// object, '.' The number should be on the same line as the object name
'dot-location': [2, 'property'],
'eol-last': 2, // Force a line break at the end of the file
'eqeqeq': [2, 'allow-null'], // Use === replace ==
'generator-star-spacing': 0, // Generator function * Before and after the space
'handle-callback-err': 0, //nodejs Handling errors
'indent': [2, 2, {
// Indent style
'SwitchCase': 1
}],
// JSX Double quotation marks or single quotation marks are used consistently in attributes
'jsx-quotes': [2, 'prefer-single'],
// Before and after the colon in the object literal
'key-spacing': [2, {
'beforeColon': false,
'afterColon': true
}],
'keyword-spacing': [2, {
'before': true,
'after': true
}],
// Function names must be capitalized with new Way to call , The first line must be lowercase without new Way to call
'new-cap': [2, {
'newIsCap': true,
'capIsNew': false
}],
'new-parens': 2, //new You have to use parentheses
'no-array-constructor': 2, // Array constructors are prohibited
'no-caller': 2, // No use arguments.caller or arguments.callee
'no-console': process.env.NODE_ENV === 'production' ? 2 : 0, // No use console
'no-class-assign': 2, // It is forbidden to assign a value to a class
'no-cond-assign': 2, // Prohibit the use of assignment statements in conditional expressions
'no-const-assign': 2, // No modification const Declared variables
'no-control-regex': 0, // Prohibit the use of control characters in regular expressions
'no-delete-var': 2, // Not right var Declared variables use delete The operator
'no-dupe-args': 2, // Function arguments cannot be repeated
'no-dupe-class-members': 2, // Duplicate declarations in classes are not allowed
'no-dupe-keys': 2, // Duplicate keys are not allowed when creating object literals {a:1,a:1}
'no-duplicate-case': 2, //switch Medium case The label cannot be repeated
'no-empty-character-class': 0, // In regular expressions [] The content cannot be empty
'no-empty-pattern': 0,
'no-eval': 0, // No use eval
'no-ex-assign': 2, // No giving catch Exception parameter assignment in statement
'no-extend-native': 2, // No extension native object
'no-extra-bind': 2, // Disable unnecessary function binding
'no-extra-boolean-cast': 2, // Prohibit unnecessary bool transformation
'no-extra-parens': [2, 'functions'], // No unnecessary brackets
'no-fallthrough': 2, // prohibit switch through
'no-floating-decimal': 2, // Do not omit... From floating-point numbers 0 .5 3.
'no-func-assign': 2, // Prohibit duplicate function declarations
'no-implied-eval': 2, // The use of implicit eval
'no-inner-declarations': [2, 'functions'], // Prohibit the use of declarations... In block statements ( Variables or functions )
'no-invalid-regexp': 2, // Disable invalid regular expressions
'no-irregular-whitespace': 2, // Can't have irregular spaces
'no-iterator': 2, // No use __iterator__ attribute
'no-label-var': 2, //label A name cannot be associated with var Declared variable names are the same
'no-labels': [2, {
// No label statement
'allowLoop': false,
'allowSwitch': false
}],
'no-lone-blocks': 2, // No unnecessary nesting of blocks
'no-mixed-spaces-and-tabs': 2, // Do not mix tab And Spaces
'no-multi-spaces': 2, // Do not use extra Spaces
'no-multi-str': 2, // String cannot be used \ Line break
'no-multiple-empty-lines': [0, {
'max': 1
}], // No more than 1 That's ok
'no-native-reassign': 2, // Can not rewrite native object
'no-negated-in-lhs': 2, //in The left side of the operator cannot have !
'no-new-object': 2, // No use new Object()
'no-new-require': 2, // No use new require
'no-new-symbol': 2, // No use new symbol
'no-new-wrappers': 2, // No use new Create a packaging instance ,new String new Boolean new Number
'no-obj-calls': 0, // Cannot call built-in global object , such as Math() JSON()
'no-octal': 2, // Octal numbers are not allowed
'no-octal-escape': 2, // Octal escape sequences are prohibited
'no-path-concat': 2, //node Cannot be used in __dirname or __filename Do path splicing
'no-proto': 2, // No use __proto__ attribute
'no-redeclare': 2, // Do not declare variables repeatedly
'no-regex-spaces': 2, // Prohibit using multiple spaces in regular expression literals /foo bar/
'no-return-assign': [2, 'except-parens'], //return There cannot be an assignment expression in a statement
'no-self-assign': 2, // Self distribution
'no-self-compare': 2, // You can't compare yourself
'no-sequences': 2, // The comma operator... Is prohibited
'no-shadow-restricted-names': 2, // The restriction identifier specified in strict mode cannot be used as the variable name when declaring
'no-spaced-func': 2, // When a function is called The function name and () There must be no space between them
'no-sparse-arrays': 2, // Disallow sparse arrays , [1,,2]
'no-this-before-super': 2, // Calling super() You can't use this or super
'no-throw-literal': 2, // Don't throw literal errors throw "error";
'no-trailing-spaces': 0, // There should be no spaces at the end of a line
'no-undef': 2, // Can't have undefined variables
'no-undef-init': 2, // Variable initialization cannot be assigned directly to undefined
'no-unexpected-multiline': 0, // Avoid multiline expressions
'no-unmodified-loop-condition': 0, // Check whether the reference is modified in the loop
'no-unneeded-ternary': 0, // No unnecessary nesting var isYes = answer === 1 ? true : false;
'no-unreachable': 2, // There can't be code that can't be executed
'no-unsafe-finally': 0,
'no-unused-vars': [2, {
'vars': 'all',
'args': 'none'
}], // Cannot have variables or parameters that are not used after declaration
'no-useless-call': 2, // Prohibit unnecessary call and apply
'no-useless-computed-key': 0, // There is no need to use calculated attributes with text
'no-useless-constructor': 2, // Class constructors that can be safely removed without changing the way classes work
'no-useless-escape': 0,
'no-whitespace-before-property': 0,
'no-with': 2, // Ban with
'one-var': 0, // A continuous statement
'operator-linebreak': [2, 'after', {
'overrides': {
'?': 'before',
':': 'before'
}
}], // Is the operator at the end of the line or at the beginning of the line
'padded-blocks': 0, // Whether the first and last line of a block statement should be empty
'quotes': [2, 'single', {
'avoidEscape': true,
'allowTemplateLiterals': true
}], // Quote type `` "" ''
'semi': [2, 'never'], // Statement forces the semicolon to end
'semi-spacing': [2, {
'before': false,
'after': true
}], // Space before and after semicolon
'space-before-blocks': [2, 'always'], // A block that doesn't start with a new line { Do you want a space in front of me
'space-before-function-paren': [2, 'never'], // Do you want spaces before parentheses when defining functions
'space-in-parens': [2, 'never'], // Do you want spaces in parentheses
'space-infix-ops': 2, // Do you want spaces around infix operators
'space-unary-ops': [2, {
'words': true,
'nonwords': false
}], // Before unary operator / Would you like to add a space after
'spaced-comment': 0, // The annotation style should not have spaces or anything
'template-curly-spacing': [2, 'never'],
'use-isnan': 2, // Do not use... When comparing NaN, Only use isNaN()
'valid-typeof': 2, // Must use legal typeof Value
'wrap-iife': [2, 'any'], // Execute the curly bracket style of the function expression immediately
'yield-star-spacing': 0,
'yoda': [2, 'never'], // Prohibition of Yoda conditions
'prefer-const': 2, // The preferred const
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, // No use debugger
'object-curly-spacing': [2, 'always', {
objectsInObjects: false
}], // Whether unnecessary spaces are allowed in braces
'array-bracket-spacing': [2, 'never'] // Whether to allow extra space in non empty array
}
}
边栏推荐
- MATLAB中strjoin函数使用
- What is oom, why it happens and some solutions
- Hou Peixin, chairman of the openharmony Working Committee of the open atom open source foundation, sent a message to the openatom openharmony sub forum
- 【Map】万能的Map使用方法 & 模糊查询的两种方式
- Overseas app push (Part 2): Channel Integration Guide for overseas manufacturers
- Redis master-slave replication principle
- Pytest interface automation test framework | rerun failed cases
- Beauty salon management system unified management system?
- File类的学习过程中出现的问题及解决方法
- 扫雷小游戏——轻松玩上瘾(C语言版)
猜你喜欢

Map函数统计字符出现的次数

11 "pocket" universities in China! Running on campus and leaving the school before accelerating

Real time synchronization and conversion of massive data based on Flink CDC

行业案例|指标中台如何助力银行业普惠金融可持续发展

CVPR 2022 new SOTA for monocular depth estimation new CRFs: neural window fullyconnected CRFs

Redis为什么这么快?Redis的线程模型与Redis多线程

Overseas app push (Part 2): Channel Integration Guide for overseas manufacturers

面试京东T5,被按在地上摩擦,鬼知道我经历了什么?

Sim900a based on STM32 sends short messages in Chinese and English

美容院管理系统统一管理制度?
随机推荐
Pytest interface automation test framework | execute use cases through markup expressions
What is per title encoding?
大佬们,请教一下,我按照文档配了cdc连接oracle,总是运行报错找不到类 ValidstionE
14.2字节流学习
How did the $50000 annual salary run out
V00 - 年纪大了,想做啥就做啥吧
pytest接口自动化测试框架 | 使用多个fixture
FPGA入门学习(二) - 二选一的选择器
[Anhui University] information sharing of postgraduate entrance examination and re examination
扫雷小游戏——轻松玩上瘾(C语言版)
y9000p2022重装win10问题
2022.7.23 ------ leetcode. Jianzhi offer.115
面试京东T5,被按在地上摩擦,鬼知道我经历了什么?
Pytest interface automation test framework | pytest configuration file
Sword finger offer 25. merge two sorted linked lists
el-form 每行显示两列,底部按钮居中
大量if else判断如何优化?@Valib详解
uniapp h5、app引用外部在线js
pytest接口自动化测试框架 | conftest.py
pytest接口自动化测试框架 | fixture调用fixture