Gathering detailed insights and metrics for eslint-config-nstarter
Gathering detailed insights and metrics for eslint-config-nstarter
Gathering detailed insights and metrics for eslint-config-nstarter
Gathering detailed insights and metrics for eslint-config-nstarter
npm install eslint-config-nstarter
Typescript
Module System
Node Version
NPM Version
54
Supply Chain
88.4
Quality
75.7
Maintenance
100
Vulnerability
96.1
License
JavaScript (75.41%)
TypeScript (22.44%)
CSS (1.07%)
Groovy (0.45%)
HTML (0.25%)
Dockerfile (0.21%)
Makefile (0.1%)
Shell (0.06%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
5,294
Last Day
1
Last Week
9
Last Month
83
Last Year
1,020
1 Stars
514 Commits
2 Watchers
4 Branches
15 Contributors
Updated on Sep 04, 2024
Minified
Minified + Gzipped
Latest Version
4.0.1
Package Id
eslint-config-nstarter@4.0.1
Unpacked Size
60.76 kB
Size
16.84 kB
File Count
8
NPM Version
10.8.1
Node Version
20.16.0
Published on
Aug 02, 2024
Cumulative downloads
Total Downloads
Last Day
-50%
1
Compared to previous day
Last Week
-59.1%
9
Compared to previous week
Last Month
50.9%
83
Compared to previous month
Last Year
-10.6%
1,020
Compared to previous year
6
5
44
NStarter ESLint 规则在腾讯 Alloy ESLint 规则基础上定制而来,用于规范化 nstarter 系列项目的代码编写规范。
名称 | 包含规则 | 解析器 |
---|---|---|
标准规则 | ESLint 规则 | @babel/eslint-parser |
TypeScript | ESLint 规则、@typescript-eslint | @typescript-eslint/parser |
大家还记得 ESLint 是怎么打败 JSHint 成为最受欢迎的 js 代码检查工具吗?就是因为 ESLint 推崇的插件化、配置化,满足了不同团队不同技术栈的个性的需求。
所以 eslint-config-nstarter 也传承了 ESLint 的设计理念,不会强调必须要使用我们这套规则,而是通过文档、示例、测试、网站等方便大家参考 nstarter 的规则,在此基础上做出自己的个性化。
无情的推动自动化
eslint-config-nstarter 通过高度的自动化,将一切能自动化管理的过程都交给脚本处理,其中包括了:
除此之外,通过自动化的脚本,我们甚至可以将成百上千个 ESLint 配置文件分而治之,每个规则在一个单独的目录下管理:
bad.js
和 good.js
输出到[网站][]中,甚至可以直接在[网站][]中看到 bad.js
的(真实运行 ESLint 脚本后的)报错信息这样的好处是显而易见的,测试即文档即[网站][],我们可以只在一个地方维护规则和测试,其他工作都交给自动化脚本,极大的降低了维护的成本。简单来说,当我们有个新规则需要添加时,只需要写三个文件 test/index/another-rule/.eslintrc.js
, test/index/another-rule/bad.js
, test/index/another-rule/good.js
即可。
安装:
1npm install --save-dev eslint eslint-config-nstarter
在你的项目根目录下创建 .eslintrc.js
,并将以下内容复制到文件中:
1module.exports = { 2 extends: [ 3 'nstarter', 4 ], 5 env: { 6 // 这里填入你的项目用到的环境 7 // 它们预定义了不同环境的全局变量,比如: 8 // 9 // browser: true, 10 // node: true, 11 // mocha: true, 12 // jest: true 13 }, 14 globals: { 15 // 这里填入你的项目需要的全局变量 16 // false 表示这个全局变量不允许被重新赋值,比如: 17 // 18 // myGlobal: false 19 }, 20 rules: { 21 // 这里填入你的项目需要的个性化配置 22 } 23};
安装:
1npm install --save-dev eslint typescript eslint-config-nstarter
在你的项目根目录下创建 .eslintrc.js
,并将以下内容复制到文件中:
1module.exports = { 2 extends: [ 3 'nstarter', 4 'nstarter/typescript', 5 ], 6 env: { 7 // 这里填入你的项目用到的环境 8 // 它们预定义了不同环境的全局变量,比如: 9 // 10 // browser: true, 11 // node: true, 12 // mocha: true, 13 // jest: true 14 }, 15 globals: { 16 // 这里填入你的项目需要的全局变量 17 // false 表示这个全局变量不允许被重新赋值,比如: 18 // 19 // myGlobal: false 20 }, 21 rules: { 22 // 这里填入你的项目需要的个性化配置 23 } 24};
在 VSCode 中,默认 ESLint 并不能识别 .ts
文件,需要在「文件 => 首选项 => 设置」里做如下配置:
1{ 2 "eslint.validate": [ 3 "javascript", 4 "typescript" 5 ] 6}
如果需要针对 .ts
文件开启 ESLint 的 autoFix,则需要配置成:
1{ 2 "eslint.autoFixOnSave": true, 3 "eslint.validate": [ 4 "javascript", 5 { 6 "language": "typescript", 7 "autoFix": true 8 } 9 ] 10}
1npm test
1# 安装依赖 2npm install 3 4# 构建 eslintrc 配置 5npm run build 6 7# 执行测试 8npm test 9 10# 自动修复格式错误 11npm run prettier:fix 12 13# 发布新版本 14npm version <major|minor|patch> 15git push --follow-tags 16npm publish
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
11 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More