diff --git a/frontend/README.md b/frontend/README.md index 98e81b74..b2df769b 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -9,7 +9,6 @@ ### CSS Styles -- although styles have `scss` extension, it is actually pack of post-css plugins, so syntax differs, for example in `calc` function. - now we are migrating to css-modules and this is recomended way to stylization. A file with styles should be named like `component.module.css` - old component styles use BEM notation (at least it should): `block__element_modifier`. Also there are `mix` classes: `block_modifier`. - new way to naming CSS selectors is camel-case like `blockElemenModifier` and use `classnames` to combine it @@ -20,12 +19,12 @@ - imports for typescript, javascript files should be without extension: `./index`, not `./index.ts` - if file resides in the same directory or in subdirectory import should be relative: `./types/something` -- otherwise it should start from ``namespace:`common/store`which mapped to`/appcommon/store.ts` in webpack, tsconfig and jest +- otherwise it should be imported by absolute path relative to `src` folder like `common/store` which mapped to `./app/common/store.ts` in webpack, tsconfig and jest ### Testing - project uses `jest` as test harness. -- jest check files that match regex `\.test\.(j|t)s(x?)$`, i.e `comment.test.tsx`, `comment.test.js` +- jest check files that match regex `\.(test|spec)\.ts(x?)$`, i.e `comment.test.tsx`, `comment.spec.ts` - tests are running on push attempt - example tests can be found in `./app/store/user/reducers.test.ts`, `./app/components/auth-panel/auth-panel.test.tsx` diff --git a/frontend/app/common/__mocks__/constants.ts b/frontend/app/common/__mocks__/constants.ts index 44374a0a..d3857d4a 100644 --- a/frontend/app/common/__mocks__/constants.ts +++ b/frontend/app/common/__mocks__/constants.ts @@ -1,7 +1,6 @@ -// @ts-ignore -const mock: typeof import('common/constants') = { +const constantsMock: typeof import('common/constants') = { ...jest.requireActual('common/constants'), BASE_URL: 'https://demo.remark42.com/', }; -module.exports = mock; +module.exports = constantsMock; diff --git a/frontend/app/common/__mocks__/settings.ts b/frontend/app/common/__mocks__/settings.ts index 6b0133c5..2be1bb6e 100644 --- a/frontend/app/common/__mocks__/settings.ts +++ b/frontend/app/common/__mocks__/settings.ts @@ -1,5 +1,4 @@ -// @ts-ignore -const mock: typeof import('common/settings') = { +const settingsMock: typeof import('common/settings') = { ...jest.requireActual('common/settings'), siteId: 'remark', pageTitle: 'remark test', @@ -17,4 +16,4 @@ const mock: typeof import('common/settings') = { }, }; -module.exports = mock; +module.exports = settingsMock; diff --git a/frontend/package.json b/frontend/package.json index 1ec3ba7c..46f87cf6 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,5 +1,4 @@ { - "private": true, "name": "remark42", "version": "0.16.0", "license": "MIT", @@ -18,7 +17,7 @@ "lint:eslint": "eslint --max-warnings=0 '**/*.{ts?(x),js}'", "lint:stylelint": "stylelint 'app/**/*.css' 'templates/**'", "size": "cross-env NODE_ENV=production run-s build check:size", - "prettier": "prettier --write './**/*.{js,ts,tsx,css}'", + "prettier": "prettier --write './**/*.{js,ts,tsx,css,html}'", "translation:extract": "formatjs extract --out-file=./extracted-messages/messages.json '**/!(*.d).ts?(x)'", "translation:generate": "node ./tasks/generateTranslations.js", "translation:check": "node ./tasks/checkTranslations.js" diff --git a/frontend/remark.image b/frontend/remark.image new file mode 100644 index 00000000..c6b90daf Binary files /dev/null and b/frontend/remark.image differ