Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-config-futu

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-config-futu - npm Package Compare versions

Comparing version 1.1.0 to 2.0.0-alpha.0

tests/3.1.naming.test.js

8

package.json
{
"name": "eslint-config-futu",
"version": "1.1.0",
"version": "2.0.0-alpha.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "jest tests"
},

@@ -17,3 +17,3 @@ "repository": {

"peerDependencies": {
"eslint": ">= 3"
"eslint": ">= 7"
},

@@ -24,4 +24,6 @@ "devDependencies": {

"@typescript-eslint/parser": "^4.11.0",
"eslint": "^8.4.1",
"jest": "^27.4.5",
"typescript": "^4.1.3"
}
}

@@ -5,2 +5,14 @@ # 富途ESLint规则

## 预设场景
- 浏览器 ✅
- Node.js ✅
- CommonJS ✅
- ES6(ES2015) ✅
- ES2017 ✅
- Jest ✅
- Vue.js ✅
- jQuery ❌
- AMD ❌
## 使用方式

@@ -19,13 +31,8 @@

root: true,
   extends: 'eslint-config-futu',
extends: 'eslint-config-futu',
env: {
browser: true,
node: true,
amd: true
},
parserOptions: {
ecmaVersion: 7,
       sourceType: 'module'
   },
   rules:{
},
rules:{
// 如果项目有特殊需求,可在此覆盖

@@ -49,3 +56,3 @@ }

root: true,
   extends: 'eslint-config-futu/typescript', // 这里要使用'eslint-config-futu/typescript'配置
extends: 'eslint-config-futu/typescript', // 这里要使用'eslint-config-futu/typescript'配置
env: {

@@ -58,3 +65,3 @@ browser: true,

ecmaVersion: 7,
       sourceType: 'module',
sourceType: 'module',
// recommend to use another config file like tsconfig.eslint.json and extends tsconfig.json in it.

@@ -64,4 +71,4 @@ // because you may be need to lint test/**/*.test.ts but no need to emit to js.

project: './tsconfig.json'
   },
   rules:{
},
rules:{
// 如果项目有特殊需求,可在此覆盖

@@ -98,12 +105,2 @@ }

### atom
apm install linter
apm install linter-ui-default
apm install linter-eslint
启用这三个插件便可
## 注:为什么不能使用全局ESLint工具

@@ -124,2 +121,6 @@

### 2.0.0-alpha.0 2021-12-17
- 修订诸多规范
### 1.1.0 2020-12-24

@@ -136,3 +137,3 @@

- 修正 tag 1.0.2
- 修正 tag 1.0.2

@@ -139,0 +140,0 @@ ### 1.0.2 2017-04-18

// eslint配置文件 - 基础配置
module.exports = {
"extends": "eslint:recommended",
"env": {
"browser": true,
"commonjs": true,
"amd": true,
"jquery": true
extends: 'eslint:recommended',
parserOptions: {
ecmaVersion: 2017,
},
"rules": {
env: {
es2017: true,
browser: true,
commonjs: true,
},
rules: {
// unix换行符
"linebreak-style": ["error", "unix"],
'linebreak-style': ['error', 'unix'],
// 驼峰命名
camelcase: ['error'],
// 构造函数名首字母大写
'new-cap': ['error'],
'id-denylist': ['error', 'a', 'b', 'c', 'd'],
// 4个空格缩进
indent: ['error', 4, { SwitchCase: 1 }],
// 中置运算符左右空格
'space-infix-ops': ['error'],
// 单目运算符空格
'space-unary-ops': ['error', { words: true, nonwords: false }],
// 关键词左右空格
'keyword-spacing': ['error'],
// 逗号在结尾
'comma-style': ['error', 'last'],
// 逗号结尾空格
'comma-spacing': ['error', { before: false, after: true }],
// 分号在结尾
'semi-style': ['error', 'last'],
// 分号结尾空格
'semi-spacing': ['error', { before: false, after: true }],
// 不允许一次声明多个变量
'one-var': ['error', 'never'],
// 不允许连续赋值
'no-multi-assign': ['error'],
// 不允许未使用的变量,但参数除外
'no-unused-vars': ['error', { args: 'none' }],
// 不允许使用var
'no-var': ['error'],
// 悬挂式大括号
"brace-style": ["error", "1tbs"],
'brace-style': ['error', '1tbs'],
// 分号党
"semi": ["error", "always"],
// 4个空格缩进
"indent": ["error", 4],
semi: ['error', 'always'],
// 字符串单引号
quotes: ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }],
// 允许常量条件
'no-constant-condition': ['warn'],
// 只允许单行省略大括号
curly: ['error', 'all'],
// 不允许魔法数字,但允许数组索引、默认值、对象中使用
'no-magic-numbers': ['error', { ignoreArrayIndexes: true, ignoreDefaultValues: true, enforceConst: false, detectObjects: false }],
// 单行代码不得超过100列,HTML模板除外
'max-len': ['error', { code: 100, ignoreComments: true, ignoreRegExpLiterals: true, ignoreStrings: false, ignoreTemplateLiterals: false, ignorePattern: '<.*>' }],
// 单函数代码不超过50行(不含空行和注释)
'max-lines-per-function': ['error', { max: 50, skipBlankLines: true, skipComments: true }],
// 函数最多接受5个参数
'max-params': ['error', { max: 5 }],
// 不允许使用逗号语句
'no-sequences': ['error'],
// Symbol带描述
'symbol-description': ['error'],
// 尽量使用箭头函数回调
'prefer-arrow-callback': ['error'],
// 箭头函数括号
'arrow-parens': ['error', 'as-needed', { requireForBlockBody: true }],
// fallthrough要有注释
'no-fallthrough': ['error', { commentPattern: 'fall ?through' }],
// 必须有default
'default-case': ['error'],
// default放最后
'default-case-last': ['error'],
// 单行注释
'line-comment-position': ['warn', { position: 'above' }],
// 未在规范中写明,但重要的
// 拒绝 tab
"no-tabs": ["error"],
// 字符串单引号
"quotes": ["error", "single"],
'no-tabs': ['error'],
// 全等号
"eqeqeq": ["error", "always"],
// 只允许单行省略大括号
"curly": ["error", "multi-line"],
eqeqeq: ['error', 'always'],
// 不重写保留字
"no-shadow-restricted-names": ["error"],
'no-shadow-restricted-names': ['error'],
// 不允许label
"no-labels": ["error"],
'no-labels': ['error'],
// 不允许扩展原型
"no-extend-native": ["error"],
// 单词运算符加空格(new typeof之类)
"space-unary-ops": ["error"],
// 运算符前后加空格
"space-infix-ops": ["error"],
'no-extend-native': ['error'],
// 不允许给自己赋值
"no-self-assign": ["error"],
'no-self-assign': ['error'],
// 不允许抛非Error实例
"no-throw-literal": ["warn"],
'no-throw-literal': ['warn'],
// 不允许重名变量
"no-shadow": ["warn", {
"builtinGlobals": true,
"hoist": "all",
"allow": [
"e",
"err",
"error",
"key",
"value",
"data",
"i",
"j",
"k",
"$",
"jQuery"
'no-shadow': ['warn', {
builtinGlobals: true,
hoist: 'all',
allow: [
'e',
'err',
'error',
'key',
'value',
'data',
'i',
'j',
'k',
]
}],
// jsdoc
"require-jsdoc": ["warn", {
"require": {
"FunctionDeclaration": true,
"MethodDefinition": true,
"ClassDeclaration": true,
"ArrowFunctionExpression": false
/* require-jsdoc: ["warn", {
require: {
FunctionDeclaration: true,
MethodDefinition: true,
ClassDeclaration: true,
ArrowFunctionExpression: false
}
}],
"valid-jsdoc": ["warn", {
"matchDescription": ".+",
"requireParamDescription": true,
"requireReturnDescription": true
}],
// 定义未使用的变量
"no-unused-vars": ["warn", {
"vars": "all",
"args": "none"
}],
valid-jsdoc: ["warn", {
matchDescription: ".+",
requireParamDescription: true,
requireReturnDescription: true
}], */
// 变量先声明再使用
"no-use-before-define": ["error", {
"variables": true,
"functions": false,
"classes": false
'no-use-before-define': ['error', {
variables: true,
functions: false,
classes: false
}],
// 不允许链式赋值, 每个变量声明单独成行
"no-multi-assign": ["warn"],
// this
"no-invalid-this": ["warn"],
// 构造函数名首字母大写
"new-cap": ["error"],
// 函数最多接受5个参数
"max-params": ["warn", {
"max": 5
}],
// 无用的 return
"no-useless-return": ["warn"],
'no-invalid-this': ['warn'],
// 不允许多层3元运算,可读性差
"no-nested-ternary": ["warn"],
'no-nested-ternary': ['error'],
// 不允许多空格(为了好看)
"no-multi-spaces": ["warn", {
"exceptions": {
"VariableDeclarator": true
'no-multi-spaces': ['warn', {
exceptions: {
VariableDeclarator: true
}
}],
// console
"no-console": 0,
// for in 遍历需过滤掉原型上的属性
"guard-for-in": ['warn'],
"prefer-const": ["error"],
"no-var": ["error"]
'prefer-const': ['error'],
'no-trailing-spaces': ['error'],
'eol-last': ['error', 'always'],
}
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc