Skip to content

Commit 0f3d4a4

Browse files
committed
refactor: add flow support to eslint configuration
- make @verdaccio/types a dev dependency - refactor the plugin main class, constructor and methods signatures to comply with the latest @verdaccio/types - remove the `files` entry from `package.json` and setup `.npmignore` to ignore everything except `bin/` and `lib/*.js`
1 parent b6ecb55 commit 0f3d4a4

34 files changed

+7673
-323
lines changed

.babelrc

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
2-
"presets": [["env", {
3-
"targets": {
4-
"node": "6"
5-
}
6-
}], "flow"]
2+
"presets": [
3+
["env", {
4+
"targets": {
5+
"node": "6"
6+
}
7+
}], "flow"
8+
]
79
}

.editorconfig

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ insert_final_newline = true
1111

1212
[*.md]
1313
trim_trailing_whitespace = false
14+

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
lib/
3+
flow-typed/

.eslintrc.yml

+28-263
Original file line numberDiff line numberDiff line change
@@ -1,268 +1,33 @@
11
env:
22
es6: true
33
node: true
4-
extends: 'eslint:recommended'
4+
parser: babel-eslint
5+
extends:
6+
- eslint:recommended
7+
- plugin:flowtype/recommended
8+
plugins:
9+
- flowtype
510
parserOptions:
6-
sourceType: module
11+
sourceType": module
12+
ecmaVersion": 6
13+
ecmaFeatures:
14+
impliedStrict: true
15+
jsx: true
716
rules:
8-
accessor-pairs: error
9-
array-bracket-newline: error
10-
array-bracket-spacing:
11-
- error
12-
- never
13-
array-callback-return: error
14-
array-element-newline: error
15-
arrow-body-style: error
16-
arrow-parens: 'off'
17-
arrow-spacing:
18-
- error
19-
- after: true
20-
before: true
21-
block-scoped-var: error
22-
block-spacing: error
23-
brace-style:
24-
- error
25-
- 1tbs
26-
callback-return: error
27-
camelcase:
28-
- error
29-
- properties: never
30-
capitalized-comments:
31-
- error
32-
- always
33-
class-methods-use-this: error
34-
comma-dangle: error
35-
comma-spacing:
36-
- error
37-
- after: true
38-
before: false
39-
comma-style:
40-
- error
41-
- last
42-
complexity: error
43-
computed-property-spacing:
44-
- error
45-
- never
46-
consistent-return: 'off'
47-
consistent-this: error
48-
curly: 'off'
49-
default-case: error
50-
dot-location:
51-
- error
52-
- object
53-
dot-notation:
54-
- error
55-
- allowKeywords: true
56-
eol-last: error
57-
eqeqeq: error
58-
for-direction: error
59-
func-call-spacing: error
60-
func-name-matching: error
61-
func-names:
62-
- error
63-
- never
64-
func-style:
65-
- error
66-
- declaration
67-
function-paren-newline: error
68-
generator-star-spacing: error
69-
getter-return: error
70-
global-require: 'off'
71-
guard-for-in: error
72-
handle-callback-err: error
73-
id-blacklist: error
74-
id-length: error
75-
id-match: error
76-
implicit-arrow-linebreak:
77-
- error
78-
- beside
79-
indent: 'off'
80-
indent-legacy: 'off'
81-
init-declarations: error
82-
jsx-quotes: error
83-
key-spacing: 'off'
84-
keyword-spacing:
85-
- error
86-
- after: true
87-
before: true
88-
line-comment-position: error
89-
linebreak-style:
90-
- error
91-
- unix
92-
lines-around-comment: error
93-
lines-around-directive: error
94-
lines-between-class-members: error
95-
max-depth: error
96-
max-len: 'off'
97-
max-lines: error
98-
max-nested-callbacks: error
99-
max-params: error
100-
max-statements: 'off'
101-
max-statements-per-line: error
102-
multiline-comment-style:
103-
- error
104-
- separate-lines
105-
multiline-ternary: error
106-
new-cap: error
107-
new-parens: error
108-
newline-after-var: 'off'
109-
newline-before-return: 'off'
110-
newline-per-chained-call: error
111-
no-alert: error
112-
no-array-constructor: error
113-
no-await-in-loop: error
114-
no-bitwise: error
115-
no-buffer-constructor: error
116-
no-caller: error
117-
no-catch-shadow: error
118-
no-confusing-arrow: error
119-
no-continue: error
120-
no-div-regex: error
121-
no-duplicate-imports: error
122-
no-else-return: 'off'
123-
no-empty-function: error
124-
no-eq-null: error
125-
no-eval: error
126-
no-extend-native: error
127-
no-extra-bind: error
128-
no-extra-label: error
129-
no-extra-parens: error
130-
no-floating-decimal: error
131-
no-implicit-coercion: error
132-
no-implicit-globals: error
133-
no-implied-eval: error
134-
no-inline-comments: 'off'
135-
no-invalid-this: error
136-
no-iterator: error
137-
no-label-var: error
138-
no-labels: error
139-
no-lone-blocks: error
140-
no-lonely-if: 'off'
141-
no-loop-func: error
142-
no-magic-numbers: 'off'
143-
no-mixed-operators: error
144-
no-mixed-requires: error
145-
no-multi-assign: error
146-
no-multi-spaces: error
147-
no-multi-str: error
148-
no-multiple-empty-lines: error
149-
no-native-reassign: error
150-
no-negated-condition: error
151-
no-negated-in-lhs: error
152-
no-nested-ternary: error
153-
no-new: error
154-
no-new-func: error
155-
no-new-object: error
156-
no-new-require: error
157-
no-new-wrappers: error
158-
no-octal-escape: error
159-
no-param-reassign: error
160-
no-path-concat: error
161-
no-plusplus: error
162-
no-process-env: error
163-
no-process-exit: error
164-
no-proto: error
165-
no-prototype-builtins: error
166-
no-restricted-globals: error
167-
no-restricted-imports: error
168-
no-restricted-modules: error
169-
no-restricted-properties: error
170-
no-restricted-syntax: error
171-
no-return-assign: error
172-
no-return-await: error
173-
no-script-url: error
174-
no-self-compare: error
175-
no-sequences: error
176-
no-shadow: error
177-
no-shadow-restricted-names: error
178-
no-spaced-func: error
179-
no-sync: error
180-
no-tabs: error
181-
no-template-curly-in-string: error
182-
no-ternary: error
183-
no-throw-literal: error
184-
no-trailing-spaces: error
185-
no-undef-init: error
186-
no-undefined: 'off'
187-
no-underscore-dangle: 'off'
188-
no-unmodified-loop-condition: error
189-
no-unneeded-ternary: error
190-
no-unused-expressions: error
191-
no-use-before-define: error
192-
no-useless-call: error
193-
no-useless-computed-key: error
194-
no-useless-concat: error
195-
no-useless-constructor: error
196-
no-useless-rename: error
197-
no-useless-return: error
198-
no-var: 'off'
199-
no-void: error
200-
no-warning-comments: error
201-
no-whitespace-before-property: error
202-
no-with: error
203-
nonblock-statement-body-position: error
204-
object-curly-newline: error
205-
object-curly-spacing:
206-
- error
207-
- never
208-
object-property-newline: error
209-
object-shorthand: error
210-
one-var: 'off'
211-
one-var-declaration-per-line: error
212-
operator-assignment: error
213-
operator-linebreak: error
214-
padded-blocks: 'off'
215-
padding-line-between-statements: error
216-
prefer-arrow-callback: 'off'
217-
prefer-const: error
218-
prefer-destructuring: error
219-
prefer-numeric-literals: error
220-
prefer-promise-reject-errors: error
221-
prefer-reflect: error
222-
prefer-rest-params: error
223-
prefer-spread: error
224-
prefer-template: error
225-
quote-props: 'off'
226-
quotes:
227-
- error
228-
- single
229-
radix: error
230-
require-await: error
231-
require-jsdoc: 'off'
232-
rest-spread-spacing: error
233-
semi: error
234-
semi-spacing: error
235-
semi-style:
236-
- error
237-
- last
238-
sort-imports: error
239-
sort-keys:
240-
- error
241-
- desc
242-
sort-vars: error
243-
space-before-blocks: error
244-
space-before-function-paren: 'off'
245-
space-in-parens:
246-
- error
247-
- never
248-
space-infix-ops: error
249-
space-unary-ops: error
250-
spaced-comment:
251-
- error
252-
- always
253-
strict: error
254-
switch-colon-spacing: error
255-
symbol-description: error
256-
template-curly-spacing: error
257-
template-tag-spacing: error
258-
unicode-bom:
259-
- error
260-
- never
261-
valid-jsdoc: error
262-
vars-on-top: 'off'
263-
wrap-iife: error
264-
wrap-regex: error
265-
yield-star-spacing: error
266-
yoda:
267-
- error
268-
- never
17+
no-useless-escape: 2
18+
handle-callback-err: 2
19+
no-fallthrough: 2
20+
no-new-require: 2
21+
max-len:
22+
- 2
23+
- 160
24+
camelcase: 0
25+
require-jsdoc: 0
26+
valid-jsdoc: 0
27+
prefer-spread: 1
28+
prefer-rest-params: 1
29+
linebreak-style: 0
30+
quote-props:
31+
- "error"
32+
- "as-needed"
33+

.flowconfig

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[ignore]
22
.*/node_modules/.*
3-
lib/.*
3+
.*/.vscode/.*
4+
.*/lib/.*
45

56
[libs]
67
node_modules/@verdaccio/types/lib/

.npmignore

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
*
2+
!bin/*
3+
!lib/*.js

README.md

+16
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,22 @@ finally run
132132
npm publish
133133
```
134134

135+
## Flow Support
136+
137+
In order to support flow, flow-typed support files are installed in the
138+
repo. These are generated based on the dependencies of the project and
139+
committed to the repository.
140+
141+
Anytime the project dependencies change, run the following command to
142+
update the flow-typed support files:
143+
144+
```bash
145+
# Just once in your environment
146+
npm install -g flow-typed
147+
148+
flow-typed install
149+
```
150+
135151
## Inspired by
136152

137153
- [verdaccio-ldap](https://github.com/Alexandre-io/verdaccio-ldap)

flow-typed/.editorconfig

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Ignore all files in this directory
2+
root = true

0 commit comments

Comments
 (0)