Gathering detailed insights and metrics for eslint-etc
Gathering detailed insights and metrics for eslint-etc
Gathering detailed insights and metrics for eslint-etc
Gathering detailed insights and metrics for eslint-etc
eslint-plugin-perfectionist
ESLint plugin for sorting various data such as objects, imports, types, enums, JSX props, etc.
eslint-plugin-etc
More general-purpose ESLint rules
@anolilab/eslint-config
ESLint shareable config for the Anolilab JavaScript style guide.
eslint-plugin-react-etc
More ESLint rules for React
npm install eslint-etc
Typescript
Module System
Node Version
NPM Version
88.8
Supply Chain
95.7
Quality
71.5
Maintenance
100
Vulnerability
96.7
License
TypeScript (99.75%)
Shell (0.25%)
Total Downloads
53,809,600
Last Day
13,509
Last Week
399,284
Last Month
1,552,298
Last Year
18,934,730
MIT License
15 Stars
231 Commits
9 Forks
3 Watchers
4 Branches
6 Contributors
Updated on Mar 29, 2023
Minified
Minified + Gzipped
Latest Version
5.2.1
Package Id
eslint-etc@5.2.1
Unpacked Size
96.90 kB
Size
17.38 kB
File Count
76
NPM Version
6.14.15
Node Version
14.18.0
Published on
Mar 28, 2023
Cumulative downloads
Total Downloads
Last Day
8.9%
13,509
Compared to previous day
Last Week
14.2%
399,284
Compared to previous week
Last Month
-11.2%
1,552,298
Compared to previous month
Last Year
22.5%
18,934,730
Compared to previous year
2
More utils for use with eslint
.
I use these utils to implement and test my own ESLint rules. That's their primary purpose, so the documentation is ... light.
fromFixture
allows TSLint-like fixtures to be used to test ESlint rules. Using fixtures means that you don't have to specify lines and columns. Instead, you underline the failure locations within the fixture, like this:
1{ 2 invalid: [ 3 fromFixture(stripIndent` 4 const name = "alice"; 5 ~~~~ [foo { "identifier": "name" }] 6 ~~~~~~~ [bar] 7 const role = 'cto'; 8 ~~~~ [foo { "identifier": "role" }] 9 `), 10 fromFixture(stripIndent` 11 const name = "alice"; 12 ~~~~ [foo { "identifier": "name" }] 13 const role = 'cto'; 14 ~~~~ [foo { "identifier": "role" }] 15 `, { 16 options: [{ bar: false }] 17 }), 18 ] 19}
which is equivalent to the following:
1{ 2 invalid: [{ 3 code: `const name = "alice"; 4const role = 'cto';`, 5 errors: [{ 6 column: 7, 7 endColumn: 11, 8 line: 1, 9 endLine: 1, 10 messageId: "foo", 11 data: { 12 identifier: "name", 13 }, 14 }, { 15 column: 14, 16 endColumn: 21, 17 line: 1, 18 endLine: 1, 19 messageId: "bar", 20 data: {}, 21 }, { 22 column: 7, 23 endColumn: 11, 24 line: 2, 25 endLine: 2, 26 messageId: "foo", 27 data: { 28 identifier: "role", 29 }, 30 }] 31 }, { 32 code: `const name = "alice"; 33const role = 'cto';`, 34 errors: [{ 35 column: 7, 36 endColumn: 11, 37 line: 1, 38 endLine: 1, 39 messageId: "foo", 40 data: { 41 identifier: "name", 42 }, 43 }, { 44 column: 7, 45 endColumn: 11, 46 line: 2, 47 endLine: 2, 48 messageId: "foo", 49 data: { 50 identifier: "role", 51 }, 52 }], 53 options: [{ 54 bar: false 55 }] 56 }] 57}
Specifying data
in the fixture is optional. If it's omitted, data
defaults to {}
.
The second, optional, argument passed to fromFixture
can be used to pass additional test case properties - options
and output
, etc.
A suggestions
array can be passed to fromFixture
via its second, optional parameter and, when passed, a suggest
annotation can be used within the fixture, like this:
1fromFixture(stripIndent` 2 const a = "alice"; 3 ~~~~~~~ [foo suggest] 4`, { 5 suggestions: [{ 6 messageId: "suggestionForFoo", 7 output: "/* suggestion output goes here */" 8 }] 9}),
And it's possible to include multiple suggest
annotations and suggestions in a single fixture:
1fromFixture(stripIndent` 2 const a = "alice"; 3 ~~~~~~~ [foo suggest 0] 4 const b = "bob"; 5 ~~~~~ [bar suggest 1] 6`, { 7 suggestions: [{ 8 messageId: "suggestionForFoo", 9 output: "/* suggestion for foo output goes here */" 10 }, { 11 messageId: "suggestionForBar", 12 output: "/* suggestion for bar output goes here */" 13 }] 14}),
The suggest
annotations work with the suggestions
array in the following manner:
suggest
is specified with no indices, all suggestions are associated with the annotated error.suggest
is specified with indices, suggestions at those indices are associated with the annotated error.suggest
is not specified, no suggestions are associated with the annotated error.suggestions
are specified without a suggest
annotation being used, fromFixture
will throw an error.And if the rule has both a fixer and suggestions, you can specify an output
- for the fixer - in conjunction with a suggestions
array:
1fromFixture(stripIndent` 2 const a = "alice"; 3 ~~~~~~~ [foo suggest] 4`, { 5 output: "/* fixer output goes here */", 6 suggestions: [{ 7 messageId: "suggestionForFoo", 8 output: "/* suggestion output goes here */" 9 }] 10}),
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 2/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
10 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-05-05
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