UNPKG

2.67 kBMarkdownView Raw
1# eslint-formatter-codeframe
2
3> ESLint’s official `codeframe` formatter, extracted from ESLint 7
4
5This formatter has been removed from ESLint 8 so it lives as a standalone module here.
6
7**Warning:** This module is not maintained. If you're an ESLint contributor or dependable open-sourcerer, open an issue here and I'll pass you this repo and npm name. You can also ping me on Twitter [@fregante](https://twitter.com/fregante)
8
9## Install
10
11```sh
12npm install --save-dev eslint-formatter-codeframe
13```
14
15## Usage
16
17More information about formatters can be found on https://eslint.org/docs/user-guide/formatters/
18
19```
20eslint --format codeframe
21```
22
23## Example output
24
25```
26error: 'addOne' is defined but never used (no-unused-vars) at fullOfProblems.js:1:10:
27> 1 | function addOne(i) {
28 | ^
29 2 | if (i != NaN) {
30 3 | return i ++
31 4 | } else {
32
33
34error: Use the isNaN function to compare with NaN (use-isnan) at fullOfProblems.js:2:9:
35 1 | function addOne(i) {
36> 2 | if (i != NaN) {
37 | ^
38 3 | return i ++
39 4 | } else {
40 5 | return
41
42
43error: Unexpected space before unary operator '++' (space-unary-ops) at fullOfProblems.js:3:16:
44 1 | function addOne(i) {
45 2 | if (i != NaN) {
46> 3 | return i ++
47 | ^
48 4 | } else {
49 5 | return
50 6 | }
51
52
53warning: Missing semicolon (semi) at fullOfProblems.js:3:20:
54 1 | function addOne(i) {
55 2 | if (i != NaN) {
56> 3 | return i ++
57 | ^
58 4 | } else {
59 5 | return
60 6 | }
61
62
63warning: Unnecessary 'else' after 'return' (no-else-return) at fullOfProblems.js:4:12:
64 2 | if (i != NaN) {
65 3 | return i ++
66> 4 | } else {
67 | ^
68 5 | return
69 6 | }
70 7 | };
71
72
73warning: Expected indentation of 8 spaces but found 6 (indent) at fullOfProblems.js:5:1:
74 3 | return i ++
75 4 | } else {
76> 5 | return
77 | ^
78 6 | }
79 7 | };
80
81
82error: Function 'addOne' expected a return value (consistent-return) at fullOfProblems.js:5:7:
83 3 | return i ++
84 4 | } else {
85> 5 | return
86 | ^
87 6 | }
88 7 | };
89
90
91warning: Missing semicolon (semi) at fullOfProblems.js:5:13:
92 3 | return i ++
93 4 | } else {
94> 5 | return
95 | ^
96 6 | }
97 7 | };
98
99
100error: Unnecessary semicolon (no-extra-semi) at fullOfProblems.js:7:2:
101 5 | return
102 6 | }
103> 7 | };
104 | ^
105
106
1075 errors and 4 warnings found.
1082 errors and 4 warnings potentially fixable with the `--fix` option.
109```
110
111## Links
112
113- [Other official ESLint formatters as standalone modules](https://github.com/fregante/eslint-formatters)
114