Skip to content

Commit bdc8c97

Browse files
authored
Lint download apis (#12)
* Lint & Add new download URLs * Add precommit * 2.7.0
1 parent 6d2cb21 commit bdc8c97

9 files changed

Lines changed: 1342 additions & 102 deletions

File tree

.eslintrc.yml

Lines changed: 284 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,284 @@
1+
env:
2+
browser: true
3+
es2020: true
4+
node: true
5+
extends: 'eslint:recommended'
6+
parserOptions:
7+
ecmaVersion: 11
8+
sourceType: module
9+
rules:
10+
indent:
11+
- error
12+
- tab
13+
quotes:
14+
- error
15+
- single
16+
semi:
17+
- error
18+
- always
19+
no-async-promise-executor: off
20+
no-ex-assign: off
21+
no-cond-assign: off
22+
no-inner-declarations: off
23+
no-obj-calls: off
24+
no-prototype-builtins: off
25+
no-unreachable: off
26+
no-unused-vars:
27+
- warn
28+
- vars: all
29+
args: after-used
30+
ignoreRestSiblings: false
31+
no-this-before-super: off
32+
no-loss-of-precision: error
33+
no-template-curly-in-string: error
34+
require-atomic-updates: error
35+
array-callback-return: error
36+
block-scoped-var: error
37+
curly:
38+
- error
39+
- multi-or-nest
40+
- consistent
41+
default-case: error
42+
default-case-last: error
43+
default-param-last: error
44+
dot-location:
45+
- error
46+
- property
47+
dot-notation: error
48+
eqeqeq:
49+
- error
50+
- smart
51+
grouped-accessor-pairs:
52+
- error
53+
- getBeforeSet
54+
max-classes-per-file:
55+
- error
56+
- 3
57+
no-caller: error
58+
no-constructor-return: error
59+
no-div-regex: warn
60+
no-else-return: error
61+
no-empty-function:
62+
- error
63+
- allow:
64+
- arrowFunctions
65+
no-eq-null: error
66+
no-eval:
67+
- error
68+
- allowIndirect: true
69+
no-extra-bind: error
70+
no-extra-label: error
71+
no-floating-decimal: error
72+
no-implicit-coercion:
73+
- error
74+
- allow:
75+
- '!!'
76+
no-implicit-globals: warn
77+
no-implied-eval: error
78+
no-invalid-this: error
79+
no-iterator: error
80+
no-labels: error
81+
no-lone-blocks: error
82+
no-loop-func: error
83+
no-magic-numbers: warn
84+
no-multi-spaces: error
85+
no-multi-str: warn
86+
no-new: error
87+
no-new-func: error
88+
no-new-wrappers: error
89+
no-proto: error
90+
no-script-url: error
91+
no-self-compare: error
92+
no-sequences: error
93+
no-throw-literal: warn
94+
no-unmodified-loop-condition: error
95+
no-unused-expressions: error
96+
no-useless-call: error
97+
no-useless-concat: error
98+
no-useless-return: error
99+
no-void: error
100+
prefer-promise-reject-errors: warn
101+
prefer-regex-literals: error
102+
radix:
103+
- error
104+
- as-needed
105+
require-await: warn
106+
wrap-iife: error
107+
yoda:
108+
- error
109+
- never
110+
- exceptRange: true
111+
strict: error
112+
no-label-var: error
113+
no-undef-init: error
114+
no-undefined: error
115+
no-use-before-define: warn
116+
array-bracket-spacing:
117+
- error
118+
- never
119+
array-element-newline:
120+
- error
121+
- consistent
122+
block-spacing: error
123+
brace-style: error
124+
camelcase: error
125+
capitalized-comments:
126+
- error
127+
- always
128+
comma-dangle: error
129+
comma-spacing: error
130+
comma-style: error
131+
computed-property-spacing: error
132+
eol-last: error
133+
func-call-spacing: error
134+
func-name-matching:
135+
- error
136+
- always
137+
func-names:
138+
- error
139+
- never
140+
func-style:
141+
- warn
142+
- declaration
143+
- allowArrowFunctions: true
144+
function-call-argument-newline:
145+
- error
146+
- consistent
147+
function-paren-newline:
148+
- error
149+
- consistent
150+
id-length:
151+
- warn
152+
- min: 1
153+
max: 15
154+
implicit-arrow-linebreak: error
155+
no-mixed-spaces-and-tabs:
156+
- error
157+
- smart-tabs
158+
jsx-quotes:
159+
- error
160+
- prefer-single
161+
key-spacing: error
162+
keyword-spacing: error
163+
linebreak-style:
164+
- error
165+
- windows
166+
lines-around-comment:
167+
- error
168+
- beforeLineComment: true
169+
allowBlockStart: true
170+
allowClassStart: true
171+
allowObjectStart: true
172+
allowArrayStart: true
173+
lines-between-class-members: error
174+
max-depth: error
175+
max-len:
176+
- error
177+
- code: 150
178+
max-nested-callbacks: error
179+
max-params:
180+
- error
181+
- max: 10
182+
max-statements-per-line:
183+
- error
184+
- max: 5
185+
multiline-comment-style:
186+
- error
187+
- separate-lines
188+
multiline-ternary:
189+
- error
190+
- always-multiline
191+
new-cap: error
192+
new-parens:
193+
- error
194+
- always
195+
newline-per-chained-call: error
196+
no-array-constructor: error
197+
no-bitwise:
198+
- warn
199+
- int32Hint: true
200+
no-lonely-if: error
201+
no-mixed-operators: error
202+
no-multiple-empty-lines: error
203+
no-negated-condition: error
204+
no-nested-ternary: error
205+
no-new-object: error
206+
no-trailing-spaces: error
207+
no-underscore-dangle: error
208+
no-unneeded-ternary: error
209+
no-whitespace-before-property: error
210+
nonblock-statement-body-position: error
211+
object-curly-newline:
212+
- error
213+
- minProperties: 1
214+
object-curly-spacing:
215+
- error
216+
- always
217+
object-property-newline: error
218+
operator-assignment: error
219+
operator-linebreak:
220+
- error
221+
- before
222+
padded-blocks:
223+
- error
224+
- never
225+
prefer-exponentiation-operator: error
226+
quote-props:
227+
- error
228+
- as-needed
229+
semi-spacing:
230+
- error
231+
- before: false
232+
after: true
233+
semi-style: error
234+
space-before-blocks: error
235+
space-before-function-paren:
236+
- error
237+
- anonymous: never
238+
named: never
239+
asyncArrow: always
240+
space-in-parens:
241+
- error
242+
- never
243+
space-infix-ops:
244+
- error
245+
- int32Hint: true
246+
space-unary-ops:
247+
- error
248+
- words: true
249+
nonwords: false
250+
spaced-comment:
251+
- error
252+
- always
253+
switch-colon-spacing: error
254+
template-tag-spacing: error
255+
unicode-bom: error
256+
arrow-body-style:
257+
- error
258+
- as-needed
259+
arrow-parens:
260+
- error
261+
- as-needed
262+
arrow-spacing: error
263+
generator-star-spacing: error
264+
no-confusing-arrow:
265+
- error
266+
- allowParens: true
267+
no-duplicate-imports: error
268+
no-useless-computed-key:
269+
- error
270+
- enforceForClassMembers: true
271+
no-useless-constructor: error
272+
no-useless-rename: error
273+
object-shorthand: error
274+
prefer-arrow-callback: warn
275+
prefer-const: error
276+
prefer-spread: error
277+
prefer-template: error
278+
rest-spread-spacing:
279+
- error
280+
- never
281+
template-curly-spacing:
282+
- error
283+
- never
284+
yield-star-spacing: error

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.travis.yml
2+
.eslintrc.yml
23
node_modules
34
ffmpeg

lib/console.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
const ProgressBar = require('progress');
2-
const format = txt=>`\x1b[37m[ffmpeg-cli]\x1b[0m ${txt}`;
3-
module.exports.error = txt=>console.error(`\x1b[1m\x1b[31mERROR! \x1b[0m\x1b[37m[ffmpeg-cli]\x1b[0m ${new Error(txt)}`);
4-
module.exports.log = txt=>console.log(format(txt));
5-
module.exports.bar = total=>(new ProgressBar(format('Downloading: [:bar] :percent :etas'), {
6-
complete: '\x1b[42m\x1b[1m \x1b[0m',
7-
incomplete: '\x1b[35m.\x1b[0m',
8-
width: 20,
9-
total: total
10-
}));
2+
const format = txt => `\x1b[37m[ffmpeg-cli]\x1b[0m ${txt}`;
3+
module.exports.error = txt => console.error(`\x1b[1m\x1b[31mERROR! \x1b[0m\x1b[37m[ffmpeg-cli]\x1b[0m ${new Error(txt)}`);
4+
module.exports.log = txt => console.log(format(txt));
5+
module.exports.bar = total => (new ProgressBar(format('Downloading: [:bar] :percent :etas'), {
6+
complete: '\x1b[42m\x1b[1m \x1b[0m',
7+
incomplete: '\x1b[35m.\x1b[0m',
8+
width: 20,
9+
total
10+
}));

0 commit comments

Comments
 (0)