Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed TSLint, added ESLint #1444

Closed
wants to merge 2 commits into from
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
45 changes: 45 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"plugins": ["@typescript-eslint", "react", "simple-import-sort"],
"rules": {
"no-fallthrough": "error",
"consistent-return": "error",
"no-undef": "warn",
"prefer-const": "warn",
"no-unused-vars": "warn",
"no-console": "warn",
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error"
},
"overrides": [
{
"files": ["*.tsx"],
"rules": {
"react/prop-types": "off"
}
}
],
"settings": {
"react": {
"version": "18.2.0"
}
},
"ignorePatterns": ["node_modules", "build", "dist"]
}
19 changes: 19 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/** @type {import("prettier").Config} */
const config = {
useTabs: false,
tabWidth: 2,
printWidth: 100,
trailingComma: 'es5',
singleQuote: true,
bracketSpacing: true,
arrowParens: 'always',
endOfLine: 'lf',
insertPragma: false,
jsxSingleQuote: true,
proseWrap: 'preserve',
quoteProps: 'as-needed',
requirePragma: false,
semi: true,
}

module.exports = config
85 changes: 42 additions & 43 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,48 @@
{
"name": "nexus-fusion",
"description": "The interface of Blue Brain Nexus, the open-source knowledge graph for data-driven science.",
"version": "1.9.1",
"author": "Blue Brain project",
"description": "The interface of Blue Brain Nexus, the open-source knowledge graph for data-driven science.",
"repository": "github:bluebrain/nexus-explorer",
"license": "Apache-2.0",
"author": "Blue Brain project",
"main": "dist/server.js",
"repository": "github:bluebrain/nexus-explorer",
"url": "https://github.com/BlueBrain/nexus/issues/new?labels=fusion",
"scripts": {
"build": "yarn clean && yarn build:client && yarn build:server",
"build:client": "vite build -c ./vite.config.refresh.js && vite build",
"build:server": "etsc --config=etsc.config.js",
"clean": "rm -rf ./dist",
"dev": "concurrently 'yarn dev:client' 'yarn dev:server'",
"dev:client": "yarn clean && concurrently 'vite build -c ./vite.config.refresh.js' 'vite'",
"dev:server": "NODE_ENV=development ts-node-dev --project tsconfig.node.json -- ./server/index.ts",
"dev": "concurrently 'yarn dev:client' 'yarn dev:server'",
"build:server": "etsc --config=etsc.config.js",
"build:client": "vite build -c ./vite.config.refresh.js && vite build",
"build": "yarn clean && yarn build:client && yarn build:server",
"knip": "knip",
"lint": "eslint --ext .ts,.tsx,.js,.jsx,.less ./src --fix",
"preview": "cross-env NODE_ENV=production node ./dist",
"test:watch": "vitest watch",
"test:ci": "vitest run",
"style": "prettier --check \"./src/**/*.{ts,tsx,js,jsx,less}\"",
"style:fix": "prettier --write \"./src/**/*.{ts,tsx,js,jsx,less}\"",
"test": "vitest",
"test:ci": "vitest run",
"test:ui": "vitest --ui",
"knip": "knip",
"lint": "tslint --project tsconfig.json",
"style": "prettier --check \"./src/**/*.{ts,tsx,js,jsx,less}\"",
"style:fix": "prettier --write \"./src/**/*.{ts,tsx,js,jsx,less}\""
"test:watch": "vitest watch"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"pre-push": "yarn lint && yarn style && yarn test"
}
},
"lint-staged": {
"*.{ts, tsx, js, jsx, less}": [
"prettier --write",
"git add"
],
"!(package).json": [
"prettier --write",
"git add"
]
},
"resolutions": {
"d3-interpolate": "2.0.1",
"headers-polyfill": "3.0.10"
},
"dependencies": {
"@ant-design/charts": "^1.4.2",
Expand Down Expand Up @@ -167,6 +186,8 @@
"@types/storybook__addon-links": "^3.3.4",
"@types/storybook__react": "^4.0.1",
"@types/string-similarity": "^4.0.0",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
"@vitejs/plugin-react": "^4.0.4",
"@vitest/ui": "^0.34.5",
"babel-loader": "^8.0.4",
Expand All @@ -178,6 +199,11 @@
"enzyme-adapter-react-16": "^1.10.0",
"esbuild": "^0.19.4",
"esbuild-node-tsc": "^2.0.5",
"eslint": "^8.55.0",
"eslint-plugin-react": "^7.33.2",
"eslint-config-next": "13.4.19",
"eslint-config-prettier": "9.0.0",
"eslint-plugin-simple-import-sort": "10.0.0",
"file-loader": "^3.0.1",
"husky": "^1.3.1",
"jsdom": "^22.1.0",
Expand All @@ -202,10 +228,6 @@
"ts-node": "^10.9.1",
"ts-node-dev": "^2.0.0",
"tsc": "^2.0.4",
"tslint": "^5.13.1",
"tslint-config-airbnb": "^5.11.1",
"tslint-config-prettier": "^1.18.0",
"tslint-react-hooks": "^2.0.0",
"typescript": "^5.1.6",
"util": "^0.12.5",
"vite": "^4.4.9",
Expand All @@ -214,31 +236,8 @@
"vite-plugin-dynamic-import": "^1.5.0",
"vitest": "^0.34.5"
},
"prettier": {
"singleQuote": true,
"trailingComma": "es5"
},
"lint-staged": {
"*.{ts, tsx, js, jsx, less}": [
"prettier --write",
"git add"
],
"!(package).json": [
"prettier --write",
"git add"
]
},
"husky": {
"hooks": {
"pre-push": "yarn lint && yarn style && yarn test",
"pre-commit": "lint-staged"
}
},
"resolutions": {
"d3-interpolate": "2.0.1",
"headers-polyfill": "3.0.10"
},
"overrides": {
"d3-interpolate": "2.0.1"
}
},
"url": "https://github.com/BlueBrain/nexus/issues/new?labels=fusion"
}
42 changes: 15 additions & 27 deletions src/__mocks__/handlers/AnalysisPlugin/handlers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { rest } from 'msw';
import { deltaPath } from '__mocks__/handlers/handlers';
import { rest } from 'msw';

import sample1 from '../../../shared/components/AnalysisPlugin/sample-images/sample1.png';

export const sparqlAnalysisReportNoResultsHandler = rest.post(
Expand Down Expand Up @@ -88,8 +89,7 @@ export const sparqlAnalysisReportSingleResult = rest.post(
},
created_by: {
type: 'uri',
value:
'https://dev.nise.bbp.epfl.ch/nexus/v1/realms/local/users/localuser',
value: 'https://dev.nise.bbp.epfl.ch/nexus/v1/realms/local/users/localuser',
},
updated_at: {
datatype: 'http://www.w3.org/2001/XMLSchema#dateTime',
Expand All @@ -98,8 +98,7 @@ export const sparqlAnalysisReportSingleResult = rest.post(
},
updated_by: {
type: 'uri',
value:
'https://dev.nise.bbp.epfl.ch/nexus/v1/realms/local/users/localuser',
value: 'https://dev.nise.bbp.epfl.ch/nexus/v1/realms/local/users/localuser',
},
self: {
type: 'uri',
Expand Down Expand Up @@ -150,8 +149,7 @@ export const reportResource = rest.get(
},
digest: {
algorithm: 'SHA-256',
value:
'caeaaba3e0b6db4ddd04d6c775521187e8309b15f60cd5c783afe4bf80fa347c',
value: 'caeaaba3e0b6db4ddd04d6c775521187e8309b15f60cd5c783afe4bf80fa347c',
},
encodingFormat: 'image/png',
},
Expand All @@ -167,26 +165,21 @@ export const reportResource = rest.get(
},
},
'schema:description': 'Analysis description sample 1',
_constrainedBy:
'https://bluebrain.github.io/nexus/schemas/unconstrained.json',
_constrainedBy: 'https://bluebrain.github.io/nexus/schemas/unconstrained.json',
_createdAt: '2022-08-11T12:51:43.983Z',
_createdBy:
'https://dev.nise.bbp.epfl.ch/nexus/v1/realms/local/users/localuser',
_createdBy: 'https://dev.nise.bbp.epfl.ch/nexus/v1/realms/local/users/localuser',
_deprecated: false,
_incoming:
'https://dev.nise.bbp.epfl.ch/nexus/v1/resources/bbp-users/nicholas/_/MyTestAnalysisReport1/incoming',
_outgoing:
'https://dev.nise.bbp.epfl.ch/nexus/v1/resources/bbp-users/nicholas/_/MyTestAnalysisReport1/outgoing',
_project:
'https://dev.nise.bbp.epfl.ch/nexus/v1/projects/bbp-users/nicholas',
_project: 'https://dev.nise.bbp.epfl.ch/nexus/v1/projects/bbp-users/nicholas',
_rev: 1,
_schemaProject:
'https://dev.nise.bbp.epfl.ch/nexus/v1/projects/bbp-users/nicholas',
_schemaProject: 'https://dev.nise.bbp.epfl.ch/nexus/v1/projects/bbp-users/nicholas',
_self:
'https://dev.nise.bbp.epfl.ch/nexus/v1/resources/bbp-users/nicholas/_/MyTestAnalysisReport1',
_updatedAt: '2022-08-11T12:51:43.983Z',
_updatedBy:
'https://dev.nise.bbp.epfl.ch/nexus/v1/realms/local/users/localuser',
_updatedBy: 'https://dev.nise.bbp.epfl.ch/nexus/v1/realms/local/users/localuser',
};
return res(ctx.status(200), ctx.json(mockResponse));
}
Expand Down Expand Up @@ -218,26 +211,21 @@ export const resourcesAnalysisReportType = rest.post(
'@id':
'https://dev.nise.bbp.epfl.ch/nexus/v1/resources/bbp-users/nicholas/_/2098607b-30ae-493f-9e07-38f4822a0787',
'@type': 'https://neuroshapes.org/AnalysisReport',
_constrainedBy:
'https://bluebrain.github.io/nexus/schemas/unconstrained.json',
_constrainedBy: 'https://bluebrain.github.io/nexus/schemas/unconstrained.json',
_createdAt: '2022-06-29T12:34:49.183Z',
_createdBy:
'https://dev.nise.bbp.epfl.ch/nexus/v1/realms/local/users/localuser',
_createdBy: 'https://dev.nise.bbp.epfl.ch/nexus/v1/realms/local/users/localuser',
_deprecated: false,
_incoming:
'https://dev.nise.bbp.epfl.ch/nexus/v1/resources/bbp-users/nicholas/_/2098607b-30ae-493f-9e07-38f4822a0787/incoming',
_outgoing:
'https://dev.nise.bbp.epfl.ch/nexus/v1/resources/bbp-users/nicholas/_/2098607b-30ae-493f-9e07-38f4822a0787/outgoing',
_project:
'https://dev.nise.bbp.epfl.ch/nexus/v1/projects/bbp-users/nicholas',
_project: 'https://dev.nise.bbp.epfl.ch/nexus/v1/projects/bbp-users/nicholas',
_rev: 1,
_schemaProject:
'https://dev.nise.bbp.epfl.ch/nexus/v1/projects/bbp-users/nicholas',
_schemaProject: 'https://dev.nise.bbp.epfl.ch/nexus/v1/projects/bbp-users/nicholas',
_self:
'https://dev.nise.bbp.epfl.ch/nexus/v1/resources/bbp-users/nicholas/_/2098607b-30ae-493f-9e07-38f4822a0787',
_updatedAt: '2022-06-29T12:34:49.183Z',
_updatedBy:
'https://dev.nise.bbp.epfl.ch/nexus/v1/realms/local/users/localuser',
_updatedBy: 'https://dev.nise.bbp.epfl.ch/nexus/v1/realms/local/users/localuser',
};

return res(
Expand Down
Loading
Loading