Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 54 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,61 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "jest"],
"plugins": ["@typescript-eslint", "simple-import-sort", "import", "unused-imports", "jest"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"plugin:jest/recommended"
]
],
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".ts"]
}
}
},
"env": {
"browser": true,
"es2021": true,
"jest": true,
"node": true
},
"parserOptions": {
"ecmaVersion": 2021,
"sourceType": "module",
"project": [
"./tsconfig.json"
]
},
"rules": {
"@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"warn",
{
"vars": "all",
"varsIgnorePattern": "^_",
"args": "after-used",
"argsIgnorePattern": "^_"
}
],
"@typescript-eslint/no-empty-function": [
"error",
{
"allow": ["arrowFunctions"]
}
],
"prettier/prettier": [
"error",
{
"semi": false,
"tabWidth": 2,
"printWidth": 100,
"singleQuote": true,
"trailingComma": "none",
"bracketSameLine": true
}
]
}
}
4 changes: 2 additions & 2 deletions .github/workflows/deploy_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ jobs:

- name: Build package
run: npm run build

- name: Update package version
run: |
run: |
SHORT_SHA=$(git rev-parse --short "${{ github.event.pull_request.head.sha }}")
CURRENT_PACKAGE_VERSION=$(cat package.json | jq -r '.version')
npm version "${CURRENT_PACKAGE_VERSION}-pr${{ github.event.number }}.${SHORT_SHA}" --no-git-tag-version
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: lint

on: push

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 19

- name: Install npm dependencies
run: npm ci

- name: Type check
run: npm run typecheck

- name: ESLint
run: npm run lint:eslint

- name: Prettier
run: npm run lint:prettier
11 changes: 7 additions & 4 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"printWidth": 120,
"trailingComma": "all",
"singleQuote": true
}
"semi": false,
"tabWidth": 2,
"printWidth": 100,
"singleQuote": true,
"trailingComma": "none",
"bracketSameLine": true
}
13 changes: 8 additions & 5 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ An unstable 2.x version of this package with breaking changes is under developme

Until a 2.0 version is officially released, it can be installed from https://github.com/IQSS/dataverse-client-javascript/pkgs/npm/dataverse-client-javascript


### Create a `.npmrc` file and add a token

To install the [@iqss/dataverse-client-javascript](https://github.com/IQSS/dataverse-client-javascript/pkgs/npm/dataverse-client-javascript)
Expand Down Expand Up @@ -89,20 +88,24 @@ function App() {
}

export default App
````
```

The same example but with example values set:

```typescript
ApiConfig.init('http://localhost:8000/api/v1', DataverseApiAuthMechanism.API_KEY, 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
ApiConfig.init(
'http://localhost:8000/api/v1',
DataverseApiAuthMechanism.API_KEY,
'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
)

function App() {
/* Yor App code */
}

export default App
````
```

We can initialize the `ApiConfig` object as an unauthenticated user, by setting `undefined` as the API Key value.
We can initialize the `ApiConfig` object as an unauthenticated user, by setting `undefined` as the API Key value.

This will allow use cases that do not require authentication to be successfully executed, but those that do require authentication will fail.
2 changes: 1 addition & 1 deletion docs/localDevelopment.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ Fix linting checks on the code:

```bash
npm run lint:fix
```
```
Loading