diff --git a/.eslintrc.json b/.eslintrc.json index 70e114be..b370361f 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -34,7 +34,10 @@ "plugin:promise/recommended", "plugin:react/recommended", "prettier" - ] + ], + "rules": { + "import/extensions": "error" + } }, { "files": [ @@ -60,9 +63,13 @@ "prettier" ], "rules": { - "import/namespace": ["error", { - "allowComputed": true - }], + "import/extensions": "error", + "import/namespace": [ + "error", + { + "allowComputed": true + } + ], "jest/no-disabled-tests": "off", "no-useless-assign/no-useless-assign": "warn", "node/no-missing-import": "off", diff --git a/src/backend/controllers/auth.js b/src/backend/controllers/auth.js index 68b69960..48e0c61a 100644 --- a/src/backend/controllers/auth.js +++ b/src/backend/controllers/auth.js @@ -4,7 +4,7 @@ import router from 'koa-joi-router'; import anonymus from 'anonymus'; import merge from 'lodash.merge'; import { getLogger } from '../log.ts'; -import { getOrcidPerson, getOrcidWorks, processWorks } from '../utils/orcid.js'; +import { getOrcidPerson, getOrcidWorks, processWorks } from '../utils/orcid'; const log = getLogger('backend:controllers:auth'); diff --git a/src/backend/controllers/docs.js b/src/backend/controllers/docs.js index 8ad1ed20..93ba6590 100644 --- a/src/backend/controllers/docs.js +++ b/src/backend/controllers/docs.js @@ -1,23 +1,23 @@ import { koaSwagger } from 'koa2-swagger-ui'; import { SwaggerAPI } from 'koa-joi-router-docs'; -import preprintRoutes from '../controllers/preprint.js'; +import preprintRoutes from '../controllers/preprint'; import { getLogger } from '../log.ts'; import router from 'koa-joi-router'; -import userRoutes from './user.js'; -import fullReviewRoutes from './fullReview.js'; -import commentRoutes from './comment.js'; -import badgeRoutes from './badge.js'; -import expertiseRoutes from './expertise.js'; -import communityRoutes from './community.js'; -import eventRoutes from './event.js'; -import groupRoutes from './group.js'; -import personaRoutes from './persona.js'; -import rapidReviewRoutes from './rapidReview.js'; -import reportRoutes from '../controllers/report.js'; -import requestRoutes from './request.js'; -import tagRoutes from './tag.js'; -import templateRoutes from './template.js'; -import notificationRoutes from '../controllers/notification.js'; +import userRoutes from './user'; +import fullReviewRoutes from './fullReview'; +import commentRoutes from './comment'; +import badgeRoutes from './badge'; +import expertiseRoutes from './expertise'; +import communityRoutes from './community'; +import eventRoutes from './event'; +import groupRoutes from './group'; +import personaRoutes from './persona'; +import rapidReviewRoutes from './rapidReview'; +import reportRoutes from '../controllers/report'; +import requestRoutes from './request'; +import tagRoutes from './tag'; +import templateRoutes from './template'; +import notificationRoutes from '../controllers/notification'; const log = getLogger('apiDocs:::'); diff --git a/src/backend/controllers/group.js b/src/backend/controllers/group.js index 50516778..54d73e2a 100644 --- a/src/backend/controllers/group.js +++ b/src/backend/controllers/group.js @@ -1,6 +1,6 @@ import router from 'koa-joi-router'; import { getLogger } from '../log.ts'; -import { getErrorMessages } from '../utils/errors.js'; +import { getErrorMessages } from '../utils/errors'; const Joi = router.Joi; const log = getLogger('backend:controllers:group'); diff --git a/src/backend/scripts/genSpec.js b/src/backend/scripts/genSpec.js index 300c2e37..22960aa2 100644 --- a/src/backend/scripts/genSpec.js +++ b/src/backend/scripts/genSpec.js @@ -1,21 +1,21 @@ import { SwaggerAPI } from 'koa-joi-router-docs'; -import preprintRoutes from '../controllers/preprint.js'; -import authWrapper from '../middleware/auth.js'; -import userRoutes from '../controllers/user.js'; -import fullReviewRoutes from '../controllers/fullReview.js'; -import commentRoutes from '../controllers/comment.js'; -import badgeRoutes from '../controllers/badge.js'; -import expertiseRoutes from '../controllers/expertise.js'; -import communityRoutes from '../controllers/community.js'; -import eventRoutes from '../controllers/event.js'; -import groupRoutes from '../controllers/group.js'; -import personaRoutes from '../controllers/persona.js'; -import rapidReviewRoutes from '../controllers/rapidReview.js'; -import reportRoutes from '../controllers/report.js'; -import requestRoutes from '../controllers/request.js'; -import tagRoutes from '../controllers/tag.js'; -import templateRoutes from '../controllers/template.js'; -import notificationRoutes from '../controllers/notification.js'; +import preprintRoutes from '../controllers/preprint'; +import authWrapper from '../middleware/auth'; +import userRoutes from '../controllers/user'; +import fullReviewRoutes from '../controllers/fullReview'; +import commentRoutes from '../controllers/comment'; +import badgeRoutes from '../controllers/badge'; +import expertiseRoutes from '../controllers/expertise'; +import communityRoutes from '../controllers/community'; +import eventRoutes from '../controllers/event'; +import groupRoutes from '../controllers/group'; +import personaRoutes from '../controllers/persona'; +import rapidReviewRoutes from '../controllers/rapidReview'; +import reportRoutes from '../controllers/report'; +import requestRoutes from '../controllers/request'; +import tagRoutes from '../controllers/tag'; +import templateRoutes from '../controllers/template'; +import notificationRoutes from '../controllers/notification'; function docs() { const generator = new SwaggerAPI(); diff --git a/src/backend/server.ts b/src/backend/server.ts index c537368d..6d8b230f 100644 --- a/src/backend/server.ts +++ b/src/backend/server.ts @@ -28,7 +28,7 @@ import serialize from 'serialize-javascript'; import { createError } from './utils/http-errors'; // Our middlewares -import authWrapper from './middleware/auth.js'; // authorization/user roles +import authWrapper from './middleware/auth'; // authorization/user roles import currentCommunity from './middleware/community'; import currentPersona from './middleware/persona'; import currentUser from './middleware/user'; @@ -58,25 +58,25 @@ import { } from './models'; // Our controllers -import AuthController from './controllers/auth.js'; // authentication/logins -import BadgeController from './controllers/badge.js'; -import CommentController from './controllers/comment.js'; -import CommunityController from './controllers/community.js'; -import ExpertiseController from './controllers/expertise.js'; -import FullReviewController from './controllers/fullReview.js'; -import DraftController from './controllers/fullReviewDraft.js'; -import GroupController from './controllers/group.js'; -import UserController from './controllers/user.js'; -import PersonaController from './controllers/persona.js'; -import PreprintController from './controllers/preprint.js'; -import RapidController from './controllers/rapidReview.js'; -import ReportController from './controllers/report.js'; -import RequestController from './controllers/request.js'; -import TagController from './controllers/tag.js'; -import TemplateController from './controllers/template.js'; -import DocsController from './controllers/docs.js'; -import EventController from './controllers/event.js'; -import NotificationController from './controllers/notification.js'; +import AuthController from './controllers/auth'; // authentication/logins +import BadgeController from './controllers/badge'; +import CommentController from './controllers/comment'; +import CommunityController from './controllers/community'; +import ExpertiseController from './controllers/expertise'; +import FullReviewController from './controllers/fullReview'; +import DraftController from './controllers/fullReviewDraft'; +import GroupController from './controllers/group'; +import UserController from './controllers/user'; +import PersonaController from './controllers/persona'; +import PreprintController from './controllers/preprint'; +import RapidController from './controllers/rapidReview'; +import ReportController from './controllers/report'; +import RequestController from './controllers/request'; +import TagController from './controllers/tag'; +import TemplateController from './controllers/template'; +import DocsController from './controllers/docs'; +import EventController from './controllers/event'; +import NotificationController from './controllers/notification'; /* eslint-disable @typescript-eslint/ban-ts-comment */ diff --git a/src/common/utils/index.ts b/src/common/utils/index.ts index 54e2e6aa..dbc202af 100644 --- a/src/common/utils/index.ts +++ b/src/common/utils/index.ts @@ -1 +1 @@ -export * from './ids.js'; +export * from './ids'; diff --git a/src/frontend/components/Communities.js b/src/frontend/components/Communities.js index 6f58d053..a15bc249 100644 --- a/src/frontend/components/Communities.js +++ b/src/frontend/components/Communities.js @@ -13,7 +13,7 @@ import { useGetCommunities, useGetTags } from '../hooks/api-hooks.tsx'; import { processParams, searchParamsToObject } from '../utils/search'; // components -import CommunityCard from './CommunityCard.js'; +import CommunityCard from './CommunityCard'; import HeaderBar from './header-bar'; import Loading from './loading'; import SearchBar from './search-bar'; diff --git a/src/frontend/components/Community.js b/src/frontend/components/Community.js index bef0409a..c85381b6 100644 --- a/src/frontend/components/Community.js +++ b/src/frontend/components/Community.js @@ -6,7 +6,7 @@ import { Helmet } from 'react-helmet-async'; import MuiSearchBar from 'material-ui-search-bar'; import { useIntl } from 'react-intl'; -import { createPreprintId } from '../../common/utils/ids.js'; +import { createPreprintId } from '../../common/utils/ids'; // contexts import UserProvider from '../contexts/user-context'; diff --git a/src/frontend/components/activity-card.js b/src/frontend/components/activity-card.js index 83d736db..ab82eb1a 100644 --- a/src/frontend/components/activity-card.js +++ b/src/frontend/components/activity-card.js @@ -5,7 +5,7 @@ import PropTypes from 'prop-types'; // utils import { getFormattedDatePosted } from '../utils/preprints'; -import { createPreprintId } from '../../common/utils/ids.js'; +import { createPreprintId } from '../../common/utils/ids'; // hooks import { useGetPreprint } from '../hooks/api-hooks.tsx'; diff --git a/src/frontend/components/dashboard.js b/src/frontend/components/dashboard.js index bc15a88a..e233d36f 100644 --- a/src/frontend/components/dashboard.js +++ b/src/frontend/components/dashboard.js @@ -5,7 +5,7 @@ import { subDays } from 'date-fns'; import { useHistory, useLocation } from 'react-router-dom'; // utils -import { createPreprintId } from '../../common/utils/ids.js'; +import { createPreprintId } from '../../common/utils/ids'; import { ORG } from '../constants'; diff --git a/src/frontend/components/preprint-card.js b/src/frontend/components/preprint-card.js index d876d771..900f13f6 100644 --- a/src/frontend/components/preprint-card.js +++ b/src/frontend/components/preprint-card.js @@ -7,7 +7,7 @@ import { formatDistanceStrict } from 'date-fns'; // utils import { getTags } from '../utils/stats'; import { getFormattedDatePosted } from '../utils/preprints'; -import { createPreprintId, decodePreprintId } from '../../common/utils/ids.js'; +import { createPreprintId, decodePreprintId } from '../../common/utils/ids'; // hooks import { useAnimatedScore } from '../hooks/score-hooks'; diff --git a/src/frontend/components/preprint-preview.js b/src/frontend/components/preprint-preview.js index b4b2d9f4..c96e8230 100644 --- a/src/frontend/components/preprint-preview.js +++ b/src/frontend/components/preprint-preview.js @@ -5,7 +5,7 @@ import { useHistory } from 'react-router-dom'; // utils import { getFormattedDatePosted } from '../utils/preprints'; -import { createPreprintId } from '../../common/utils/ids.js'; +import { createPreprintId } from '../../common/utils/ids'; // Material UI components import { makeStyles } from '@material-ui/core/styles'; diff --git a/src/frontend/components/recent-activity.js b/src/frontend/components/recent-activity.js index d386f1b8..1e75f7ef 100644 --- a/src/frontend/components/recent-activity.js +++ b/src/frontend/components/recent-activity.js @@ -4,7 +4,7 @@ import PropTypes from 'prop-types'; //utils import { formatDistanceStrict } from 'date-fns'; -import { createPreprintId } from '../../common/utils/ids.js'; +import { createPreprintId } from '../../common/utils/ids'; //material ui import Link from '@material-ui/core/Link'; diff --git a/src/frontend/components/reviews.js b/src/frontend/components/reviews.js index 991e3911..058ae897 100644 --- a/src/frontend/components/reviews.js +++ b/src/frontend/components/reviews.js @@ -36,7 +36,7 @@ import { } from '../hooks/ui-hooks'; // utils -import { createPreprintId } from '../../common/utils/ids.js'; +import { createPreprintId } from '../../common/utils/ids'; import { processParams, searchParamsToObject } from '../utils/search'; // components diff --git a/src/frontend/components/shell-content.js b/src/frontend/components/shell-content.js index fa6f8f87..df70c601 100644 --- a/src/frontend/components/shell-content.js +++ b/src/frontend/components/shell-content.js @@ -8,7 +8,7 @@ import { useLocation } from 'react-router-dom'; import { usePostRequests } from '../hooks/api-hooks.tsx'; // utils -import { createPreprintId } from '../../common/utils/ids.js'; +import { createPreprintId } from '../../common/utils/ids'; // Material UI imports import { makeStyles } from '@material-ui/core/styles';