Skip to content

Commit bde0535

Browse files
lint and prettier
1 parent 45bd9b1 commit bde0535

File tree

18 files changed

+94
-79
lines changed

18 files changed

+94
-79
lines changed

.eslintrc.json

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
{
2-
"env": {
3-
"es6": true,
4-
"node": true
5-
},
6-
"extends": "eslint:recommended",
7-
"rules": {
8-
"indent": ["error", 2],
9-
"linebreak-style": ["error", "unix"],
10-
"quotes": ["error", "single", {
11-
"avoidEscape": true,
12-
"allowTemplateLiterals": true
13-
}],
14-
"semi": ["error", "always"],
15-
"no-var": "error",
16-
"strict": ["error", "safe"]
17-
}
18-
}
2+
"parser": "@typescript-eslint/parser",
3+
"env": {
4+
"es6": true,
5+
"node": true
6+
},
7+
"extends": [
8+
"eslint:recommended",
9+
"plugin:@typescript-eslint/eslint-recommended",
10+
"plugin:@typescript-eslint/recommended"
11+
],
12+
"parserOptions": {
13+
"ecmaVersion": 2018,
14+
"sourceType": "module"
15+
},
16+
"rules": {
17+
"@typescript-eslint/no-var-requires": "off",
18+
"no-var": "error"
19+
}
20+
}

.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 --no-install lint-staged

.prettierrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"trailingComma": "none",
3+
"tabWidth": 2,
4+
"semi": true,
5+
"singleQuote": true,
6+
"useTabs": false,
7+
"arrowParens": "avoid"
8+
}

package.json

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
"updated": "lerna updated",
88
"test": "jest",
99
"publish": "lerna publish --exact",
10-
"precommit": "lint-staged"
10+
"precommit": "lint-staged",
11+
"prepare": "husky install"
1112
},
1213
"lint-staged": {
1314
"*.js": [
14-
"prettier-eslint --write",
15-
"jest --findRelatedTests",
16-
"git add"
15+
"prettier --single-quote --write",
16+
"jest --findRelatedTests"
1717
]
1818
},
1919
"jest": {
@@ -22,11 +22,17 @@
2222
"collectCoverage": true
2323
},
2424
"devDependencies": {
25+
"@typescript-eslint/eslint-plugin": "5.0.0",
26+
"@typescript-eslint/parser": "5.0.0",
2527
"codecov": "3.7.1",
26-
"husky": "3.0.9",
28+
"eslint": "8.0.1",
29+
"eslint-config-prettier": "8.3.0",
30+
"eslint-plugin-prettier": "4.0.0",
31+
"husky": "7.0.2",
2732
"jest": "24.9.0",
28-
"lerna": "^2.3.1",
29-
"lint-staged": "9.4.2",
30-
"prettier-eslint-cli": "5.0.0"
33+
"lerna": "2.3.1",
34+
"lint-staged": "11.2.3",
35+
"prettier": "2.4.1",
36+
"typescript": "4.4.4"
3137
}
3238
}

packages/oc-azure-storage-adapter/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
# Description
2+
23
`⚠️ THIS ADAPTER IS EXPERIMENTAL, USE CAREFULLY`
34

45
Allows oc registry to store its components within [Azure Blob Storage](https://azure.microsoft.com/en-gb/services/storage/blobs/).
56

67
# Configuration
8+
79
```javascript
810
var azureStorageAdapter = require('oc-azure-storage-adapter');
911
...
1012
storage: {
1113
adapter: azureStorageAdapter,
1214
options: {
13-
// Container that will store publicly available files.
15+
// Container that will store publicly available files.
1416
// It's ACL should be set to 'blob' ({ "publicAccess": "blob" })
1517
publicContainerName: 'oc-public',
16-
// Container that will store private files.
18+
// Container that will store private files.
1719
// It's ACL should be set to 'Private' ({ "publicAccess": "off" })
1820
privateContainerName: 'oc-private',
1921
accountName: '<your_azure_account_name>',

packages/oc-azure-storage-adapter/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const stream = require('stream');
1111

1212
const { getFileInfo, strings } = require('oc-storage-adapters-utils');
1313

14-
module.exports = function(conf) {
14+
module.exports = function (conf) {
1515
const isValid = () => {
1616
if (
1717
!conf.publicContainerName ||
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# oc-gs-storage-adapter
1+
# oc-gs-storage-adapter

packages/oc-gs-storage-adapter/__mocks__/@google-cloud/storage.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,21 @@ const _Storage = class {
3232
bucket === 'my-empty-bucket'
3333
? []
3434
: [
35-
[
36-
{
37-
name: 'components/image/1.0.0/app.js'
38-
},
39-
{
40-
name: 'components/image/1.0.0/server.js'
41-
},
42-
{
43-
name: 'components/image/1.0.1/new-server.js'
44-
},
45-
{
46-
name: 'components/image/1.0.1/new-app.js'
47-
}
48-
]
49-
];
35+
[
36+
{
37+
name: 'components/image/1.0.0/app.js'
38+
},
39+
{
40+
name: 'components/image/1.0.0/server.js'
41+
},
42+
{
43+
name: 'components/image/1.0.1/new-server.js'
44+
},
45+
{
46+
name: 'components/image/1.0.1/new-app.js'
47+
}
48+
]
49+
];
5050
return Promise.resolve(files);
5151
},
5252
upload: (filePath, { destination }) => {

packages/oc-gs-storage-adapter/__test__/gs.test.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,7 @@ test('test getJson force mode', done => {
169169
{ path: 'components/image', expected: ['1.0.0', '1.0.1'] },
170170
{ path: 'components/image/', expected: ['1.0.0', '1.0.1'] }
171171
].forEach(scenario => {
172-
test(`test listSubDirectories when bucket is not empty for folder ${
173-
scenario.path
174-
}`, done => {
172+
test(`test listSubDirectories when bucket is not empty for folder ${scenario.path}`, done => {
175173
const client = new gs({ bucket: 'my-bucket' });
176174

177175
client.listSubDirectories(scenario.path, (err, data) => {

packages/oc-gs-storage-adapter/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const {
1414
strings
1515
} = require('oc-storage-adapters-utils');
1616

17-
module.exports = function(conf) {
17+
module.exports = function (conf) {
1818
const isValid = () => {
1919
if (!conf.bucket || !conf.projectId || !conf.path) {
2020
return false;
@@ -57,9 +57,9 @@ module.exports = function(conf) {
5757
callback(
5858
err.code === 404
5959
? {
60-
code: strings.errors.STORAGE.FILE_NOT_FOUND_CODE,
61-
msg: format(strings.errors.STORAGE.FILE_NOT_FOUND, filePath)
62-
}
60+
code: strings.errors.STORAGE.FILE_NOT_FOUND_CODE,
61+
msg: format(strings.errors.STORAGE.FILE_NOT_FOUND, filePath)
62+
}
6363
: err
6464
)
6565
);

0 commit comments

Comments
 (0)