Skip to content

Commit 822733f

Browse files
authored
feat: linter and formatter (#4)
1 parent 0f260e9 commit 822733f

File tree

142 files changed

+12309
-7037
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+12309
-7037
lines changed

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
dist
3+
types

.eslintrc.js

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

99

1010
jobs:
11+
checks:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
- uses: actions/setup-node@v3
16+
with:
17+
node-version: '18.x'
18+
- name: "Run checks"
19+
run: |
20+
npm install
21+
npm run lint
22+
npm run format:check
23+
1124
tests:
12-
name: Tests
25+
needs: checks
1326
runs-on: ubuntu-latest
1427
steps:
1528
- uses: actions/checkout@v3
@@ -38,8 +51,8 @@ jobs:
3851
- name: "Stop weavaite"
3952
run: ci/stop_dependencies.sh
4053

41-
deploy:
42-
needs: Tests
54+
publish:
55+
needs: tests
4356
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
4457
runs-on: ubuntu-latest
4558
steps:

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.DS_Store
22
dist/
3+
types/
34
coverage/
45
node_modules/
56
config.yaml
@@ -9,3 +10,4 @@ weaviate-data/
910
.idea/
1011
*.tgz
1112
.npmrc
13+
.eslintcache

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx lint-staged

.npmignore

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
.github/
2-
ci/
3-
coverage/
4-
examples/
5-
test/
6-
**/*.test.ts
7-
.babelrc
8-
.editorconfig
9-
CODE_OF_CONDUCT.md
10-
CONTRIBUTE.md
11-
build.js
12-
.vscode/
13-
.idea/
14-
tsconfig-test.json
15-
jest.config.json
16-
.npmrc
1+
# This file is written to be a whitelist instead of a blacklist. Start by
2+
# ignoring everything, then add back the files we want to be included in the
3+
# final NPM package.
4+
*
5+
6+
# And these are the files that are allowed.
7+
!/LICENSE
8+
!/README.md
9+
!/package.json
10+
!/dist/**/*
11+
!/types/**/*

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"semi": true,
3+
"arrowParens": "always",
4+
"trailingComma": "es5",
5+
"bracketSpacing": true,
6+
"singleQuote": true
7+
}

0 commit comments

Comments
 (0)