* style: Do not use default exports

* chore: Add ESLint rule import/no-default-export
This commit is contained in:
Eemeli Aro 2022-05-12 20:08:18 +03:00 коммит произвёл GitHub
Родитель e990e4eb26
Коммит 1097eaa5a5
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
301 изменённых файлов: 1262 добавлений и 1133 удалений

387
package-lock.json сгенерированный
Просмотреть файл

@ -55,6 +55,7 @@
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.6",
"eslint": "^8.9.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-react": "^7.22.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^27.5.1",
@ -3059,6 +3060,12 @@
"integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==",
"dev": true
},
"node_modules/@types/json5": {
"version": "0.0.29",
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
"integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=",
"dev": true
},
"node_modules/@types/linkify-it": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-3.0.2.tgz",
@ -5153,6 +5160,168 @@
"url": "https://opencollective.com/eslint"
}
},
"node_modules/eslint-import-resolver-node": {
"version": "0.3.6",
"resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz",
"integrity": "sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw==",
"dev": true,
"dependencies": {
"debug": "^3.2.7",
"resolve": "^1.20.0"
}
},
"node_modules/eslint-import-resolver-node/node_modules/debug": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dev": true,
"dependencies": {
"ms": "^2.1.1"
}
},
"node_modules/eslint-module-utils": {
"version": "2.7.3",
"resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.3.tgz",
"integrity": "sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==",
"dev": true,
"dependencies": {
"debug": "^3.2.7",
"find-up": "^2.1.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/eslint-module-utils/node_modules/debug": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dev": true,
"dependencies": {
"ms": "^2.1.1"
}
},
"node_modules/eslint-module-utils/node_modules/find-up": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz",
"integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=",
"dev": true,
"dependencies": {
"locate-path": "^2.0.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/eslint-module-utils/node_modules/locate-path": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz",
"integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=",
"dev": true,
"dependencies": {
"p-locate": "^2.0.0",
"path-exists": "^3.0.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/eslint-module-utils/node_modules/p-limit": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz",
"integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==",
"dev": true,
"dependencies": {
"p-try": "^1.0.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/eslint-module-utils/node_modules/p-locate": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz",
"integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=",
"dev": true,
"dependencies": {
"p-limit": "^1.1.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/eslint-module-utils/node_modules/p-try": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz",
"integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=",
"dev": true,
"engines": {
"node": ">=4"
}
},
"node_modules/eslint-module-utils/node_modules/path-exists": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
"dev": true,
"engines": {
"node": ">=4"
}
},
"node_modules/eslint-plugin-import": {
"version": "2.26.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz",
"integrity": "sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==",
"dev": true,
"dependencies": {
"array-includes": "^3.1.4",
"array.prototype.flat": "^1.2.5",
"debug": "^2.6.9",
"doctrine": "^2.1.0",
"eslint-import-resolver-node": "^0.3.6",
"eslint-module-utils": "^2.7.3",
"has": "^1.0.3",
"is-core-module": "^2.8.1",
"is-glob": "^4.0.3",
"minimatch": "^3.1.2",
"object.values": "^1.1.5",
"resolve": "^1.22.0",
"tsconfig-paths": "^3.14.1"
},
"engines": {
"node": ">=4"
},
"peerDependencies": {
"eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8"
}
},
"node_modules/eslint-plugin-import/node_modules/debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"dev": true,
"dependencies": {
"ms": "2.0.0"
}
},
"node_modules/eslint-plugin-import/node_modules/doctrine": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
"integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==",
"dev": true,
"dependencies": {
"esutils": "^2.0.2"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/eslint-plugin-import/node_modules/ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
"dev": true
},
"node_modules/eslint-plugin-react": {
"version": "7.29.4",
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.29.4.tgz",
@ -9056,6 +9225,12 @@
"node": "*"
}
},
"node_modules/minimist": {
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
"dev": true
},
"node_modules/moo": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/moo/-/moo-0.5.1.tgz",
@ -11055,6 +11230,39 @@
"node": ">=10"
}
},
"node_modules/tsconfig-paths": {
"version": "3.14.1",
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz",
"integrity": "sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ==",
"dev": true,
"dependencies": {
"@types/json5": "^0.0.29",
"json5": "^1.0.1",
"minimist": "^1.2.6",
"strip-bom": "^3.0.0"
}
},
"node_modules/tsconfig-paths/node_modules/json5": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz",
"integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==",
"dev": true,
"dependencies": {
"minimist": "^1.2.0"
},
"bin": {
"json5": "lib/cli.js"
}
},
"node_modules/tsconfig-paths/node_modules/strip-bom": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
"integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=",
"dev": true,
"engines": {
"node": ">=4"
}
},
"node_modules/tslib": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz",
@ -13811,6 +14019,12 @@
"integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==",
"dev": true
},
"@types/json5": {
"version": "0.0.29",
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
"integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=",
"dev": true
},
"@types/linkify-it": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-3.0.2.tgz",
@ -15494,6 +15708,144 @@
}
}
},
"eslint-import-resolver-node": {
"version": "0.3.6",
"resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz",
"integrity": "sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw==",
"dev": true,
"requires": {
"debug": "^3.2.7",
"resolve": "^1.20.0"
},
"dependencies": {
"debug": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dev": true,
"requires": {
"ms": "^2.1.1"
}
}
}
},
"eslint-module-utils": {
"version": "2.7.3",
"resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.3.tgz",
"integrity": "sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==",
"dev": true,
"requires": {
"debug": "^3.2.7",
"find-up": "^2.1.0"
},
"dependencies": {
"debug": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dev": true,
"requires": {
"ms": "^2.1.1"
}
},
"find-up": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz",
"integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=",
"dev": true,
"requires": {
"locate-path": "^2.0.0"
}
},
"locate-path": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz",
"integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=",
"dev": true,
"requires": {
"p-locate": "^2.0.0",
"path-exists": "^3.0.0"
}
},
"p-limit": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz",
"integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==",
"dev": true,
"requires": {
"p-try": "^1.0.0"
}
},
"p-locate": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz",
"integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=",
"dev": true,
"requires": {
"p-limit": "^1.1.0"
}
},
"p-try": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz",
"integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=",
"dev": true
},
"path-exists": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
"dev": true
}
}
},
"eslint-plugin-import": {
"version": "2.26.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz",
"integrity": "sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==",
"dev": true,
"requires": {
"array-includes": "^3.1.4",
"array.prototype.flat": "^1.2.5",
"debug": "^2.6.9",
"doctrine": "^2.1.0",
"eslint-import-resolver-node": "^0.3.6",
"eslint-module-utils": "^2.7.3",
"has": "^1.0.3",
"is-core-module": "^2.8.1",
"is-glob": "^4.0.3",
"minimatch": "^3.1.2",
"object.values": "^1.1.5",
"resolve": "^1.22.0",
"tsconfig-paths": "^3.14.1"
},
"dependencies": {
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"dev": true,
"requires": {
"ms": "2.0.0"
}
},
"doctrine": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
"integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==",
"dev": true,
"requires": {
"esutils": "^2.0.2"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
"dev": true
}
}
},
"eslint-plugin-react": {
"version": "7.29.4",
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.29.4.tgz",
@ -18333,6 +18685,12 @@
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
"dev": true
},
"moo": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/moo/-/moo-0.5.1.tgz",
@ -19904,6 +20262,35 @@
}
}
},
"tsconfig-paths": {
"version": "3.14.1",
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz",
"integrity": "sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ==",
"dev": true,
"requires": {
"@types/json5": "^0.0.29",
"json5": "^1.0.1",
"minimist": "^1.2.6",
"strip-bom": "^3.0.0"
},
"dependencies": {
"json5": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz",
"integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==",
"dev": true,
"requires": {
"minimist": "^1.2.0"
}
},
"strip-bom": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
"integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=",
"dev": true
}
}
},
"tslib": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz",

Просмотреть файл

@ -71,6 +71,7 @@
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.6",
"eslint": "^8.9.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-react": "^7.22.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^27.5.1",

Просмотреть файл

@ -3,7 +3,7 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
plugins: ['@typescript-eslint', 'import'],
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
env: {
browser: true,
@ -20,5 +20,6 @@ module.exports = {
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-inferrable-types': 0,
'@typescript-eslint/prefer-as-const': 0,
'import/no-default-export': 'error',
},
};

Просмотреть файл

@ -45,4 +45,5 @@ const config = {
},
};
// eslint-disable-next-line import/no-default-export
export default config;

Просмотреть файл

@ -4,8 +4,9 @@
// import { shallow } from 'enzyme';
// import sinon from 'sinon';
// import App from './App';
// import store from '~/store';
// import { App } from './App';
// import { App } from './App';
// import { store } from '~/store';
describe('<App>', () => {
it('renders without crashing', () => {

Просмотреть файл

@ -7,11 +7,11 @@ import { initLocale, Locale, updateLocale } from './context/locale';
import { Location } from './context/location';
import { WaveLoader } from './core/loaders';
import { NAME as NOTIFICATION, NotificationPanel } from './core/notification';
import { NOTIFICATION, NotificationPanel } from './core/notification';
import { addRawNotification } from './core/notification/actions';
import { getProject } from './core/project/actions';
import { getResource } from './core/resource/actions';
import { UserControls } from './core/user';
import { UserControls } from './core/user/components/UserControls';
import { getUsersList } from './core/user/actions';
import { useAppDispatch, useAppSelector } from './hooks';
@ -25,7 +25,7 @@ import { InteractiveTour } from './modules/interactivetour/components/Interactiv
import { Navigation } from './modules/navbar/components/Navigation';
import { ProjectInfo } from './modules/projectinfo/components/ProjectInfo';
import { ResourceProgress } from './modules/resourceprogress';
import { SearchBox } from './modules/search';
import { SearchBox } from './modules/search/components/SearchBox';
/**
* Main entry point to the application. Will render the structure of the page.

Просмотреть файл

@ -2,7 +2,7 @@ import NProgress from 'nprogress';
import { addComment } from '~/api/comment';
import { addNotification } from '~/core/notification/actions';
import notificationMessages from '~/core/notification/messages';
import { notificationMessages } from '~/core/notification/messages';
import { get as getHistory } from '~/modules/history/actions';
import { get as getTeamComments } from '~/modules/teamcomments/actions';
import type { AppDispatch } from '~/store';
@ -29,7 +29,3 @@ export function addComment_(
NProgress.done();
};
}
export default {
addComment: addComment_,
};

Просмотреть файл

@ -2,7 +2,7 @@ import React from 'react';
import { shallow } from 'enzyme';
import sinon from 'sinon';
import AddComment from './AddComment';
import { AddComment } from './AddComment';
const USER = {
user: {

Просмотреть файл

@ -56,7 +56,7 @@ declare module 'slate' {
}
}
export default function AddComment(props: Props): React.ReactElement<'div'> {
export function AddComment(props: Props): React.ReactElement<'div'> {
const {
parameters,
translation,

Просмотреть файл

@ -2,7 +2,7 @@ import React from 'react';
import { shallow } from 'enzyme';
import sinon from 'sinon';
import Comment from './Comment';
import { Comment } from './Comment';
describe('<Comment>', () => {
const DEFAULT_COMMENT = {

Просмотреть файл

@ -16,7 +16,7 @@ type Props = {
togglePinnedStatus?: (status: boolean, id: number) => void;
};
export default function Comment(props: Props): null | React.ReactElement<'li'> {
export function Comment(props: Props): null | React.ReactElement<'li'> {
const { comment, canPin, togglePinnedStatus } = props;
if (!comment) {

Просмотреть файл

@ -1,7 +1,7 @@
import React from 'react';
import { shallow } from 'enzyme';
import CommentsList from './CommentsList';
import { CommentsList } from './CommentsList';
describe('<CommentsList>', () => {
const DEFAULT_USER = 'AnnPerkins';

Просмотреть файл

@ -4,7 +4,8 @@ import React from 'react';
import type { TranslationComment } from '~/api/comment';
import type { HistoryTranslation } from '~/api/translation';
import type { LocationType } from '~/context/location';
import { AddComment, Comment } from '~/core/comments';
import { AddComment } from '~/core/comments/components/AddComment';
import { Comment } from '~/core/comments/components/Comment';
import type { UserState } from '~/core/user';
import './CommentsList.css';
@ -22,7 +23,7 @@ type Props = {
resetContactPerson?: () => void;
};
export default function CommentsList(props: Props): React.ReactElement<'div'> {
export function CommentsList(props: Props): React.ReactElement<'div'> {
const {
comments,
parameters,

Просмотреть файл

@ -1,5 +0,0 @@
export { default as actions } from './actions';
export { default as AddComment } from './components/AddComment';
export { default as Comment } from './components/Comment';
export { default as CommentsList } from './components/CommentsList';

Просмотреть файл

@ -10,7 +10,7 @@ import { PluralFormType } from '~/context/pluralForm';
import type { UnsavedChanges } from '~/context/unsavedChanges';
import { updateEntityTranslation } from '~/core/entities/actions';
import { addNotification } from '~/core/notification/actions';
import notificationMessages from '~/core/notification/messages';
import { notificationMessages } from '~/core/notification/messages';
import { updateResource } from '~/core/resource/actions';
import { updateStats } from '~/core/stats/actions';
import { AppThunk } from '~/store';
@ -42,6 +42,21 @@ export const UPDATE_MACHINERY_SOURCES: 'editor/UPDATE_MACHINERY_SOURCES' =
export type Translation = string | Entry;
export type Action =
| EndUpdateTranslationAction
| InitialTranslationAction
| ResetEditorAction
| ResetHelperElementIndexAction
| ResetFailedChecksAction
| ResetSelectionAction
| SelectHelperElementIndexAction
| SelectHelperTabIndexAction
| StartUpdateTranslationAction
| UpdateAction
| UpdateFailedChecksAction
| UpdateSelectionAction
| UpdateMachinerySourcesAction;
/**
* Update the current translation of the selected entity.
*/
@ -50,7 +65,7 @@ export type UpdateAction = {
readonly translation: Translation;
readonly changeSource: string;
};
export function update(
export function updateTranslation(
translation: Translation,
changeSource?: string,
): UpdateAction {
@ -135,7 +150,9 @@ export type SelectHelperTabIndexAction = {
readonly type: typeof SELECT_HELPER_TAB_INDEX;
readonly index: number;
};
function selectHelperTabIndex(index: number): SelectHelperTabIndexAction {
export function selectHelperTabIndex(
index: number,
): SelectHelperTabIndexAction {
return {
type: SELECT_HELPER_TAB_INDEX,
index,
@ -196,7 +213,7 @@ export function resetSelection(): ResetSelectionAction {
export type ResetEditorAction = {
readonly type: typeof RESET_EDITOR;
};
export function reset(): ResetEditorAction {
export function resetEditor(): ResetEditorAction {
return {
type: RESET_EDITOR,
};
@ -293,7 +310,7 @@ export function sendTranslation_(
} else if (nextEntity.pk !== entity.pk) {
location.push({ entity: nextEntity.pk });
}
dispatch(reset());
dispatch(resetEditor());
}
} else if (content.failedChecks) {
dispatch(updateFailedChecks(content.failedChecks, 'submitted'));
@ -307,19 +324,3 @@ export function sendTranslation_(
NProgress.done();
};
}
export default {
endUpdateTranslation,
reset,
resetFailedChecks,
resetHelperElementIndex,
resetSelection,
selectHelperElementIndex,
selectHelperTabIndex,
setInitialTranslation,
startUpdateTranslation,
update,
updateFailedChecks,
updateSelection,
updateMachinerySources,
};

Просмотреть файл

@ -10,7 +10,7 @@ import {
import * as editorActions from '../actions';
import * as ExistingTranslation from '../hooks/useExistingTranslation';
import EditorMainAction from './EditorMainAction';
import { EditorMainAction } from './EditorMainAction';
beforeAll(() => {
sinon.stub(Translator, 'useTranslator');

Просмотреть файл

@ -5,7 +5,7 @@ import { useAppSelector } from '~/hooks';
import { useTranslator } from '~/hooks/useTranslator';
import { useExistingTranslation } from '../hooks/useExistingTranslation';
import { useUpdateTranslationStatus } from '../index';
import { useUpdateTranslationStatus } from '../hooks/useUpdateTranslationStatus';
type Props = {
sendTranslation: (ignoreWarnings?: boolean) => void;
@ -22,7 +22,7 @@ type Props = {
* Otherwise, if the "force suggestion" user setting is on, it renders "Suggest".
* Otherwise, it renders "Save".
*/
export default function EditorMainAction({
export function EditorMainAction({
sendTranslation,
}: Props): React.ReactElement<React.ElementType> {
const isRunningRequest = useAppSelector(

Просмотреть файл

@ -10,10 +10,10 @@ import { RECEIVE_ENTITIES } from '~/core/entities/actions';
import { createDefaultUser, createReduxStore } from '~/test/store';
import { MockLocalizationProvider } from '~/test/utils';
import EditorMenu from './EditorMenu';
import EditorSettings from './EditorSettings';
import KeyboardShortcuts from './KeyboardShortcuts';
import TranslationLength from './TranslationLength';
import { EditorMenu } from './EditorMenu';
import { EditorSettings } from './EditorSettings';
import { KeyboardShortcuts } from './KeyboardShortcuts';
import { TranslationLength } from './TranslationLength';
const SELECTED_ENTITY = {
pk: 1,

Просмотреть файл

@ -1,5 +1,5 @@
import { Localized } from '@fluent/react';
import * as React from 'react';
import React from 'react';
import { useSelectedEntity } from '~/core/entities/hooks';
import * as user from '~/core/user';
@ -7,11 +7,11 @@ import { saveSetting } from '~/core/user/actions';
import { useAppDispatch, useAppSelector } from '~/hooks';
import { UnsavedChangesPopup } from '~/modules/unsavedchanges/components/UnsavedChangesPopup';
import EditorMainAction from './EditorMainAction';
import { EditorMainAction } from './EditorMainAction';
import './EditorMenu.css';
import EditorSettings from './EditorSettings';
import FailedChecks from './FailedChecks';
import KeyboardShortcuts from './KeyboardShortcuts';
import { EditorSettings } from './EditorSettings';
import { FailedChecks } from './FailedChecks';
import { KeyboardShortcuts } from './KeyboardShortcuts';
type Props = {
firstItemHook?: React.ReactNode;
@ -28,7 +28,7 @@ type Props = {
* If the entity is read-only, shows a read-only notification.
* Otherise, shows the various tools to control the editor.
*/
export default function EditorMenu(props: Props): React.ReactElement<'menu'> {
export function EditorMenu(props: Props): React.ReactElement<'menu'> {
return (
<menu className='editor-menu'>
{props.firstItemHook}

Просмотреть файл

@ -2,12 +2,12 @@ import React from 'react';
import { shallow } from 'enzyme';
import sinon from 'sinon';
import EditorSettingsBase, { EditorSettings } from './EditorSettings';
import { EditorSettings, EditorSettingsDialog } from './EditorSettings';
function createEditorSettings() {
function createEditorSettingsDialog() {
const toggleSettingMock = sinon.stub();
const wrapper = shallow(
<EditorSettings
<EditorSettingsDialog
settings={{
runQualityChecks: false,
forceSuggestions: false,
@ -18,9 +18,9 @@ function createEditorSettings() {
return [wrapper, toggleSettingMock];
}
describe('<EditorSettings>', () => {
describe('<EditorSettingsDialog>', () => {
it('toggles the runQualityChecks setting', () => {
const [wrapper, toggleSettingMock] = createEditorSettings();
const [wrapper, toggleSettingMock] = createEditorSettingsDialog();
// Do it once to turn it on.
wrapper.find('.menu li').at(0).simulate('click');
@ -36,7 +36,7 @@ describe('<EditorSettings>', () => {
});
it('toggles the forceSuggestions setting', () => {
const [wrapper, toggleSettingMock] = createEditorSettings();
const [wrapper, toggleSettingMock] = createEditorSettingsDialog();
// Do it once to turn it on.
wrapper.find('.menu li').at(1).simulate('click');
@ -52,15 +52,15 @@ describe('<EditorSettings>', () => {
});
});
describe('<EditorSettingsBase>', () => {
describe('<EditorSettings>', () => {
it('toggles the settings menu when clicking the gear icon', () => {
const wrapper = shallow(<EditorSettingsBase />);
expect(wrapper.find('EditorSettings')).toHaveLength(0);
const wrapper = shallow(<EditorSettings />);
expect(wrapper.find('EditorSettingsDialog')).toHaveLength(0);
wrapper.find('.selector').simulate('click');
expect(wrapper.find('EditorSettings')).toHaveLength(1);
expect(wrapper.find('EditorSettingsDialog')).toHaveLength(1);
wrapper.find('.selector').simulate('click');
expect(wrapper.find('EditorSettings')).toHaveLength(0);
expect(wrapper.find('EditorSettingsDialog')).toHaveLength(0);
});
});

Просмотреть файл

@ -17,7 +17,7 @@ type EditorSettingsProps = {
onDiscard: () => void;
};
export function EditorSettings({
export function EditorSettingsDialog({
settings,
toggleSetting,
onDiscard,
@ -72,7 +72,7 @@ export function EditorSettings({
/*
* Renders settings to be used to customize interactions with the Editor.
*/
export default function EditorSettingsBase({
export function EditorSettings({
settings,
updateSetting,
}: Props): React.ReactElement<'div'> {
@ -97,7 +97,7 @@ export default function EditorSettingsBase({
/>
{visible && (
<EditorSettings
<EditorSettingsDialog
settings={settings}
toggleSetting={toggleSetting}
onDiscard={handleDiscard}

Просмотреть файл

@ -2,7 +2,7 @@ import React from 'react';
import sinon from 'sinon';
import { Locale } from '~/context/locale';
import * as editor from '~/core/editor';
import { updateFailedChecks } from '~/core/editor/actions';
import {
createDefaultUser,
@ -10,7 +10,7 @@ import {
mountComponentWithStore,
} from '~/test/store';
import FailedChecks from './FailedChecks';
import { FailedChecks } from './FailedChecks';
function createFailedChecks(user) {
const store = createReduxStore({ project: { slug: 'firefox', tags: [] } });
@ -37,7 +37,7 @@ describe('<FailedChecks>', () => {
const [wrapper, store] = createFailedChecks();
store.dispatch(
editor.actions.updateFailedChecks(
updateFailedChecks(
{
clErrors: ['one error'],
pndbWarnings: ['a warning', 'two warnings'],
@ -60,10 +60,7 @@ describe('<FailedChecks>', () => {
});
store.dispatch(
editor.actions.updateFailedChecks(
{ pndbWarnings: ['a warning'] },
'submitted',
),
updateFailedChecks({ pndbWarnings: ['a warning'] }, 'submitted'),
);
wrapper.update();
@ -76,10 +73,7 @@ describe('<FailedChecks>', () => {
});
store.dispatch(
editor.actions.updateFailedChecks(
{ pndbWarnings: ['a warning'] },
'submitted',
),
updateFailedChecks({ pndbWarnings: ['a warning'] }, 'submitted'),
);
wrapper.update();
@ -90,10 +84,7 @@ describe('<FailedChecks>', () => {
const [wrapper, store] = createFailedChecks({ manager_for_locales: [] });
store.dispatch(
editor.actions.updateFailedChecks(
{ pndbWarnings: ['a warning'] },
'submitted',
),
updateFailedChecks({ pndbWarnings: ['a warning'] }, 'submitted'),
);
wrapper.update();
@ -103,9 +94,7 @@ describe('<FailedChecks>', () => {
it('renders approve anyway button if translation with warnings approved', () => {
const [wrapper, store] = createFailedChecks();
store.dispatch(
editor.actions.updateFailedChecks({ pndbWarnings: ['a warning'] }, ''),
);
store.dispatch(updateFailedChecks({ pndbWarnings: ['a warning'] }, ''));
wrapper.update();
expect(wrapper.find('.approve.anyway')).toHaveLength(1);

Просмотреть файл

@ -6,7 +6,8 @@ import type { UserState } from '~/core/user';
import { useAppDispatch, useAppSelector } from '~/hooks';
import { useTranslator } from '~/hooks/useTranslator';
import { actions, useUpdateTranslationStatus } from '..';
import { resetFailedChecks } from '../actions';
import { useUpdateTranslationStatus } from '../hooks/useUpdateTranslationStatus';
import './FailedChecks.css';
@ -18,7 +19,7 @@ type FailedChecksProps = {
* Shows a list of failed checks (errors and warnings) and a button to ignore
* those checks and proceed anyway.
*/
export default function FailedChecks(
export function FailedChecks(
props: FailedChecksProps,
): null | React.ReactElement<'div'> {
const dispatch = useAppDispatch();
@ -35,7 +36,7 @@ export default function FailedChecks(
}
function resetChecks() {
dispatch(actions.resetFailedChecks());
dispatch(resetFailedChecks());
}
function approveAnyway() {

Просмотреть файл

@ -9,7 +9,7 @@ type KeyboardShortcutsProps = {
onDiscard: () => void;
};
function KeyboardShortcuts({ onDiscard }: KeyboardShortcutsProps) {
function KeyboardShortcutsDialog({ onDiscard }: KeyboardShortcutsProps) {
const ref = React.useRef(null);
useOnDiscard(ref, onDiscard);
return (
@ -200,7 +200,7 @@ function KeyboardShortcuts({ onDiscard }: KeyboardShortcutsProps) {
/*
* Shows a list of keyboard shortcuts.
*/
export default function KeyboardShortcutsBase(): React.ReactElement<'div'> {
export function KeyboardShortcuts(): React.ReactElement<'div'> {
const [visible, setVisible] = useState(false);
const toggleVisible = useCallback(() => setVisible((prev) => !prev), []);
const handleDiscard = useCallback(() => setVisible(false), []);
@ -215,7 +215,7 @@ export default function KeyboardShortcutsBase(): React.ReactElement<'div'> {
/>
</Localized>
{visible && <KeyboardShortcuts onDiscard={handleDiscard} />}
{visible && <KeyboardShortcutsDialog onDiscard={handleDiscard} />}
</div>
);
}

Просмотреть файл

@ -1,7 +1,7 @@
import React from 'react';
import { shallow } from 'enzyme';
import TranslationLength from './TranslationLength';
import { TranslationLength } from './TranslationLength';
describe('<TranslationLength>', () => {
const LENGTH_ENTITY = {

Просмотреть файл

@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';
import './TranslationLength.css';
@ -16,7 +16,7 @@ type Props = {
* syntax in the comment to define maximum translation length. MAX_LENGTH
* is provided for strings without HTML tags, so they need to be stripped.
*/
export default function TranslationLength({
export function TranslationLength({
comment,
format,
original,

Просмотреть файл

@ -1,12 +1,12 @@
import { useCallback } from 'react';
import { useAppDispatch } from '~/hooks';
import { actions } from '..';
import { updateSelection } from '../actions';
/**
* Return a function to add text to the content of the editor.
*/
export default function useAddTextToTranslation(): (
export function useAddTextToTranslation(): (
content: string,
changeSource?: string,
) => void {
@ -14,7 +14,7 @@ export default function useAddTextToTranslation(): (
return useCallback(
(content: string, changeSource?: string) => {
dispatch(actions.updateSelection(content, changeSource));
dispatch(updateSelection(content, changeSource));
},
[dispatch],
);

Просмотреть файл

@ -1,9 +1,9 @@
import useUpdateTranslation from './useUpdateTranslation';
import { useUpdateTranslation } from './useUpdateTranslation';
/**
* Return a function to clear the content of the editor.
*/
export default function useClearEditor(): () => void {
export function useClearEditor(): () => void {
const updateTranslation = useUpdateTranslation();
return () => {

Просмотреть файл

@ -1,29 +1,27 @@
import { useCallback } from 'react';
import type { MachineryTranslation, SourceType } from '~/api/machinery';
import { NAME as EDITOR } from '~/core/editor';
import { EDITOR } from '../reducer';
import { useAppDispatch, useAppSelector } from '~/hooks';
import { useReadonlyEditor } from '~/hooks/useReadonlyEditor';
import actions from '../actions';
import useAddTextToTranslation from './useAddTextToTranslation';
import useUpdateTranslation from './useUpdateTranslation';
import { updateMachinerySources } from '../actions';
import { useAddTextToTranslation } from './useAddTextToTranslation';
import { useUpdateTranslation } from './useUpdateTranslation';
/**
* Return a function to copy the original translation into the editor.
*/
export default function useCopyMachineryTranslation(
export function useCopyMachineryTranslation(
entity?: number | null,
): (translation: MachineryTranslation) => void {
const dispatch = useAppDispatch();
const addTextToTranslation = useAddTextToTranslation();
const updateTranslation = useUpdateTranslation();
const updateMachinerySources = useCallback(
const updateMachinerySources_ = useCallback(
(machinerySources: Array<SourceType>, machineryTranslation: string) => {
dispatch(
actions.updateMachinerySources(machinerySources, machineryTranslation),
);
dispatch(updateMachinerySources(machinerySources, machineryTranslation));
},
[dispatch],
);
@ -57,7 +55,7 @@ export default function useCopyMachineryTranslation(
else {
updateTranslation(translation.translation, 'machinery');
}
updateMachinerySources(translation.sources, translation.translation);
updateMachinerySources_(translation.sources, translation.translation);
},
[
isFluentTranslationMessage,
@ -65,7 +63,7 @@ export default function useCopyMachineryTranslation(
entity,
addTextToTranslation,
updateTranslation,
updateMachinerySources,
updateMachinerySources_,
],
);
}

Просмотреть файл

@ -1,12 +1,12 @@
import { useSelectedEntity } from '~/core/entities/hooks';
import { usePluralForm } from '~/context/pluralForm';
import useUpdateTranslation from './useUpdateTranslation';
import { useUpdateTranslation } from './useUpdateTranslation';
/**
* Return a function to copy the original translation into the editor.
*/
export default function useCopyOriginalIntoEditor(): () => void {
export function useCopyOriginalIntoEditor(): () => void {
const updateTranslation = useUpdateTranslation();
const entity = useSelectedEntity();

Просмотреть файл

@ -3,12 +3,12 @@ import { useCallback } from 'react';
import type { OtherLocaleTranslation } from '~/api/other-locales';
import { useReadonlyEditor } from '~/hooks/useReadonlyEditor';
import useUpdateTranslation from './useUpdateTranslation';
import { useUpdateTranslation } from './useUpdateTranslation';
/**
* Return a function to copy the other locale translation into the editor.
*/
export default function useCopyOtherLocaleTranslation(): (
export function useCopyOtherLocaleTranslation(): (
translation: OtherLocaleTranslation,
) => void {
const updateTranslation = useUpdateTranslation();

Просмотреть файл

@ -1,7 +1,7 @@
import sinon from 'sinon';
import * as PluralForm from '~/context/pluralForm';
import fluentParser from '~/core/utils/fluent/parser';
import flattenMessage from '~/core/utils/fluent/flattenMessage';
import { parser as fluentParser } from '~/core/utils/fluent/parser';
import { flattenMessage } from '~/core/utils/fluent/flattenMessage';
import * as Hooks from '~/hooks';
import * as SelectedEntity from '~/core/entities/hooks';

Просмотреть файл

@ -1,12 +1,12 @@
import { useTranslationForEntity } from '~/context/pluralForm';
import { useSelectedEntity } from '~/core/entities/hooks';
import getReconstructedMessage from '~/core/utils/fluent/getReconstructedMessage';
import fluentParser from '~/core/utils/fluent/parser';
import fluentSerializer from '~/core/utils/fluent/serializer';
import { getReconstructedMessage } from '~/core/utils/fluent/getReconstructedMessage';
import { parser as fluentParser } from '~/core/utils/fluent/parser';
import { serializer as fluentSerializer } from '~/core/utils/fluent/serializer';
import { useAppSelector } from '~/hooks';
import { NAME as HISTORY } from '~/modules/history';
import { HISTORY } from '~/modules/history';
import { NAME as EDITOR } from '../index';
import { EDITOR } from '../reducer';
/**
* Return a Translation identical to the one currently in the Editor.

Просмотреть файл

@ -5,17 +5,17 @@ import { useAppDispatch, useAppSelector } from '~/hooks';
import { useReadonlyEditor } from '~/hooks/useReadonlyEditor';
import { resetFailedChecks, selectHelperElementIndex } from '../actions';
import useClearEditor from './useClearEditor';
import useCopyMachineryTranslation from './useCopyMachineryTranslation';
import useCopyOriginalIntoEditor from './useCopyOriginalIntoEditor';
import useCopyOtherLocaleTranslation from './useCopyOtherLocaleTranslation';
import { useClearEditor } from './useClearEditor';
import { useCopyMachineryTranslation } from './useCopyMachineryTranslation';
import { useCopyOriginalIntoEditor } from './useCopyOriginalIntoEditor';
import { useCopyOtherLocaleTranslation } from './useCopyOtherLocaleTranslation';
import { useExistingTranslation } from './useExistingTranslation';
import useUpdateTranslationStatus from './useUpdateTranslationStatus';
import { useUpdateTranslationStatus } from './useUpdateTranslationStatus';
/**
* Return a function to handle shortcuts in a translation form.
*/
export default function useHandleShortcuts(): (
export function useHandleShortcuts(): (
event: React.KeyboardEvent<HTMLTextAreaElement>,
sendTranslation: (ignoreWarnings?: boolean, translation?: string) => void,
clearEditorCustom?: () => void,

Просмотреть файл

@ -1,9 +1,9 @@
import * as React from 'react';
import React from 'react';
import { useAppDispatch, useAppSelector } from '~/hooks';
import * as editor from '~/core/editor';
import { resetSelection } from '../actions';
export default function useReplaceSelectionContent(
export function useReplaceSelectionContent(
updateTranslationSelectionWith: (content: string, source: string) => void,
) {
const dispatch = useAppDispatch();
@ -20,7 +20,7 @@ export default function useReplaceSelectionContent(
// must use this hook and pass it a function specific to its needs.
if (selectionReplacementContent) {
updateTranslationSelectionWith(selectionReplacementContent, changeSource);
dispatch(editor.actions.resetSelection());
dispatch(resetSelection());
}
}, [
changeSource,

Просмотреть файл

@ -12,7 +12,7 @@ import { sendTranslation_ } from '../actions';
/**
* Return a function to send a translation to the server.
*/
export default function useSendTranslation(): (
export function useSendTranslation(): (
ignoreWarnings?: boolean,
content?: string,
) => void {

Просмотреть файл

@ -1,14 +1,14 @@
import { useCallback } from 'react';
import { actions } from '..';
import type { Translation } from '~/core/editor';
import { useAppDispatch } from '~/hooks';
import { updateTranslation } from '../actions';
/**
* Return a function to update the content of the editor.
*/
export default function useUpdateTranslation(): (
export function useUpdateTranslation(): (
translation: Translation,
changeSource?: string,
) => void {
@ -16,7 +16,7 @@ export default function useUpdateTranslation(): (
return useCallback(
(translation: Translation, changeSource?: string) => {
dispatch(actions.update(translation, changeSource));
dispatch(updateTranslation(translation, changeSource));
},
[dispatch],
);

Просмотреть файл

@ -13,7 +13,7 @@ import { startUpdateTranslation, endUpdateTranslation } from '../actions';
/**
* Return a function to update the status (approved, rejected... ) of a translation.
*/
export default function useUpdateTranslationStatus(): (
export function useUpdateTranslationStatus(): (
translationId: number,
change: ChangeOperation,
ignoreWarnings: boolean,

Просмотреть файл

@ -3,7 +3,7 @@ import { UnsavedChanges } from '~/context/unsavedChanges';
import { useAppSelector } from '~/hooks';
export default function useUpdateUnsavedChanges(richEditor: boolean) {
export function useUpdateUnsavedChanges(richEditor: boolean) {
const translation = useAppSelector((state) => state.editor.translation);
const initialTranslation = useAppSelector(
(state) => state.editor.initialTranslation,

Просмотреть файл

@ -1,27 +1,21 @@
export { default as actions } from './actions';
export { default as reducer } from './reducer';
export { EditorMenu } from './components/EditorMenu';
export { EditorSettings } from './components/EditorSettings';
export { FailedChecks } from './components/FailedChecks';
export { KeyboardShortcuts } from './components/KeyboardShortcuts';
export { TranslationLength } from './components/TranslationLength';
export { default as EditorMenu } from './components/EditorMenu';
export { default as EditorSettings } from './components/EditorSettings';
export { default as FailedChecks } from './components/FailedChecks';
export { default as KeyboardShortcuts } from './components/KeyboardShortcuts';
export { default as TranslationLength } from './components/TranslationLength';
export { default as useAddTextToTranslation } from './hooks/useAddTextToTranslation';
export { default as useClearEditor } from './hooks/useClearEditor';
export { default as useCopyMachineryTranslation } from './hooks/useCopyMachineryTranslation';
export { default as useCopyOriginalIntoEditor } from './hooks/useCopyOriginalIntoEditor';
export { default as useCopyOtherLocaleTranslation } from './hooks/useCopyOtherLocaleTranslation';
export { default as useHandleShortcuts } from './hooks/useHandleShortcuts';
export { default as useSendTranslation } from './hooks/useSendTranslation';
export { default as useReplaceSelectionContent } from './hooks/useReplaceSelectionContent';
export { default as useUpdateTranslation } from './hooks/useUpdateTranslation';
export { default as useUpdateTranslationStatus } from './hooks/useUpdateTranslationStatus';
export { default as useUpdateUnsavedChanges } from './hooks/useUpdateUnsavedChanges';
export { useAddTextToTranslation } from './hooks/useAddTextToTranslation';
export { useClearEditor } from './hooks/useClearEditor';
export { useCopyMachineryTranslation } from './hooks/useCopyMachineryTranslation';
export { useCopyOriginalIntoEditor } from './hooks/useCopyOriginalIntoEditor';
export { useCopyOtherLocaleTranslation } from './hooks/useCopyOtherLocaleTranslation';
export { useHandleShortcuts } from './hooks/useHandleShortcuts';
export { useSendTranslation } from './hooks/useSendTranslation';
export { useReplaceSelectionContent } from './hooks/useReplaceSelectionContent';
export { useUpdateTranslation } from './hooks/useUpdateTranslation';
export { useUpdateTranslationStatus } from './hooks/useUpdateTranslationStatus';
export { useUpdateUnsavedChanges } from './hooks/useUpdateUnsavedChanges';
export { EDITOR } from './reducer';
export type { EditorState } from './reducer';
export type { Translation } from './actions';
// Name of this module.
// Used as the key to store this module's reducer.
export const NAME = 'editor';

Просмотреть файл

@ -2,6 +2,8 @@ import type { SourceType } from '~/api/machinery';
import type { FailedChecks } from '~/api/translation';
import {
Action,
Translation,
END_UPDATE_TRANSLATION,
RESET_FAILED_CHECKS,
RESET_SELECTION,
@ -17,37 +19,9 @@ import {
UPDATE_MACHINERY_SOURCES,
} from './actions';
import type {
EndUpdateTranslationAction,
InitialTranslationAction,
ResetEditorAction,
ResetHelperElementIndexAction,
ResetFailedChecksAction,
ResetSelectionAction,
SelectHelperElementIndexAction,
SelectHelperTabIndexAction,
StartUpdateTranslationAction,
Translation,
UpdateAction,
UpdateFailedChecksAction,
UpdateSelectionAction,
UpdateMachinerySourcesAction,
} from './actions';
type Action =
| EndUpdateTranslationAction
| InitialTranslationAction
| ResetEditorAction
| ResetHelperElementIndexAction
| ResetFailedChecksAction
| ResetSelectionAction
| SelectHelperElementIndexAction
| SelectHelperTabIndexAction
| StartUpdateTranslationAction
| UpdateAction
| UpdateFailedChecksAction
| UpdateSelectionAction
| UpdateMachinerySourcesAction;
// Name of this module.
// Used as the key to store this module's reducer.
export const EDITOR = 'editor';
export type EditorState = {
readonly translation: Translation;
@ -128,7 +102,7 @@ const initial: EditorState = {
selectedHelperTabIndex: 0,
};
export default function reducer(
export function reducer(
state: EditorState = initial,
action: Action,
): EditorState {

Просмотреть файл

@ -4,7 +4,7 @@ import type { Entity } from '~/api/entity';
import { Location } from '~/context/location';
import { useAppSelector } from '~/hooks';
import { NAME as ENTITIES } from './reducer';
import { ENTITIES } from './reducer';
export const useEntities = () => useAppSelector((state) => state[ENTITIES]);

Просмотреть файл

@ -12,7 +12,7 @@ import {
// Name of this module.
// Used as the key to store this module's reducer.
export const NAME = 'entities';
export const ENTITIES = 'entities';
type EntitiesState = {
readonly entities: Entity[];

Просмотреть файл

@ -2,7 +2,7 @@ import React from 'react';
import './SkeletonLoader.css';
export default function SkeletonLoader({
export function SkeletonLoader({
sentryRef,
items,
}: {

Просмотреть файл

@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';
import './WaveLoader.css';
@ -19,5 +19,3 @@ export const WaveLoader = (): React.ReactElement<any> => (
</div>
</div>
);
export default WaveLoader;

Просмотреть файл

@ -1,2 +1,2 @@
export { default as WaveLoader } from './components/WaveLoader';
export { default as SkeletonLoader } from './components/SkeletonLoader';
export { WaveLoader } from './components/WaveLoader';
export { SkeletonLoader } from './components/SkeletonLoader';

Просмотреть файл

@ -13,6 +13,8 @@ export type NotificationMessage = {
readonly key?: string;
};
export type Action = AddAction;
/**
* Add a localized notification to display.
*

Просмотреть файл

@ -1,9 +1,4 @@
export { default as reducer } from './reducer';
export { NotificationPanel } from './components/NotificationPanel';
export { NOTIFICATION } from './reducer';
export type { NotificationState } from './reducer';
// Name of this module.
// Used as the key to store this module's reducer.
export const NAME = 'notification';

Просмотреть файл

@ -1,8 +1,8 @@
import * as React from 'react';
import React from 'react';
import { Localized } from '@fluent/react';
import type { NotificationMessage } from './actions';
const messages: Record<string, NotificationMessage> = {
export const notificationMessages: Record<string, NotificationMessage> = {
TRANSLATION_APPROVED: {
content: (
<Localized id='notification--translation-approved'>
@ -162,5 +162,3 @@ const messages: Record<string, NotificationMessage> = {
type: 'info',
},
};
export default messages;

Просмотреть файл

@ -1,8 +1,10 @@
import { ADD } from './actions';
import type { AddAction, NotificationMessage } from './actions';
import type { Action, NotificationMessage } from './actions';
type Action = AddAction;
// Name of this module.
// Used as the key to store this module's reducer.
export const NOTIFICATION = 'notification';
export type NotificationState = {
readonly message: NotificationMessage | null | undefined;
@ -12,7 +14,7 @@ const initial: NotificationState = {
message: null,
};
export default function reducer(
export function reducer(
state: NotificationState = initial,
action: Action,
): NotificationState {

Просмотреть файл

@ -1,7 +1,7 @@
import React from 'react';
import { shallow } from 'enzyme';
import WithPlaceables from './WithPlaceables';
import { WithPlaceables } from './WithPlaceables';
describe('Test parser order', () => {
it('matches JSON placeholder', () => {

Просмотреть файл

@ -2,35 +2,35 @@ import createMarker from 'react-content-marker';
import './WithPlaceables.css';
import altAttribute from '../parsers/altAttribute';
import camelCaseString from '../parsers/camelCaseString';
import emailPattern from '../parsers/emailPattern';
import escapeSequence from '../parsers/escapeSequence';
import filePattern from '../parsers/filePattern';
import javaFormattingVariable from '../parsers/javaFormattingVariable';
import jsonPlaceholder from '../parsers/jsonPlaceholder';
import leadingSpace from '../parsers/leadingSpace';
import multipleSpaces from '../parsers/multipleSpaces';
import narrowNonBreakingSpace from '../parsers/narrowNonBreakingSpace';
import newlineCharacter from '../parsers/newlineCharacter';
import newlineEscape from '../parsers/newlineEscape';
import nonBreakingSpace from '../parsers/nonBreakingSpace';
import nsisVariable from '../parsers/nsisVariable';
import numberString from '../parsers/numberString';
import optionPattern from '../parsers/optionPattern';
import punctuation from '../parsers/punctuation';
import pythonFormatNamedString from '../parsers/pythonFormatNamedString';
import pythonFormatString from '../parsers/pythonFormatString';
import pythonFormattingVariable from '../parsers/pythonFormattingVariable';
import qtFormatting from '../parsers/qtFormatting';
import shortCapitalNumberString from '../parsers/shortCapitalNumberString';
import stringFormattingVariable from '../parsers/stringFormattingVariable';
import tabCharacter from '../parsers/tabCharacter';
import thinSpace from '../parsers/thinSpace';
import unusualSpace from '../parsers/unusualSpace';
import uriPattern from '../parsers/uriPattern';
import xmlEntity from '../parsers/xmlEntity';
import xmlTag from '../parsers/xmlTag';
import { altAttribute } from '../parsers/altAttribute';
import { camelCaseString } from '../parsers/camelCaseString';
import { emailPattern } from '../parsers/emailPattern';
import { escapeSequence } from '../parsers/escapeSequence';
import { filePattern } from '../parsers/filePattern';
import { javaFormattingVariable } from '../parsers/javaFormattingVariable';
import { jsonPlaceholder } from '../parsers/jsonPlaceholder';
import { leadingSpace } from '../parsers/leadingSpace';
import { multipleSpaces } from '../parsers/multipleSpaces';
import { narrowNonBreakingSpace } from '../parsers/narrowNonBreakingSpace';
import { newlineCharacter } from '../parsers/newlineCharacter';
import { newlineEscape } from '../parsers/newlineEscape';
import { nonBreakingSpace } from '../parsers/nonBreakingSpace';
import { nsisVariable } from '../parsers/nsisVariable';
import { numberString } from '../parsers/numberString';
import { optionPattern } from '../parsers/optionPattern';
import { punctuation } from '../parsers/punctuation';
import { pythonFormatNamedString } from '../parsers/pythonFormatNamedString';
import { pythonFormatString } from '../parsers/pythonFormatString';
import { pythonFormattingVariable } from '../parsers/pythonFormattingVariable';
import { qtFormatting } from '../parsers/qtFormatting';
import { shortCapitalNumberString } from '../parsers/shortCapitalNumberString';
import { stringFormattingVariable } from '../parsers/stringFormattingVariable';
import { tabCharacter } from '../parsers/tabCharacter';
import { thinSpace } from '../parsers/thinSpace';
import { unusualSpace } from '../parsers/unusualSpace';
import { uriPattern } from '../parsers/uriPattern';
import { xmlEntity } from '../parsers/xmlEntity';
import { xmlTag } from '../parsers/xmlTag';
// Note: the order of these MATTERS!
export const rules = [
@ -82,6 +82,4 @@ export const rules = [
/**
* Component that marks placeables in a string.
*/
const WithPlaceables: any = createMarker(rules);
export default WithPlaceables;
export const WithPlaceables: any = createMarker(rules);

Просмотреть файл

@ -2,7 +2,7 @@ import React from 'react';
import { shallow } from 'enzyme';
import each from 'jest-each';
import WithPlaceablesForFluent from './WithPlaceablesForFluent';
import { WithPlaceablesForFluent } from './WithPlaceablesForFluent';
describe('<WithPlaceablesForFluent>', () => {
each([

Просмотреть файл

@ -4,11 +4,11 @@ import type { Parser } from 'react-content-marker';
import './WithPlaceables.css';
import { rules } from './WithPlaceables';
import fluentFunction from '../parsers/fluentFunction';
import fluentParametrizedTerm from '../parsers/fluentParametrizedTerm';
import fluentString from '../parsers/fluentString';
import fluentTerm from '../parsers/fluentTerm';
import multipleSpaces from '../parsers/multipleSpaces';
import { fluentFunction } from '../parsers/fluentFunction';
import { fluentParametrizedTerm } from '../parsers/fluentParametrizedTerm';
import { fluentString } from '../parsers/fluentString';
import { fluentTerm } from '../parsers/fluentTerm';
import { multipleSpaces } from '../parsers/multipleSpaces';
export function getRulesWithFluent(rules: Array<Parser>): Array<Parser> {
const newRules = [...rules];
@ -30,6 +30,6 @@ export function getRulesWithFluent(rules: Array<Parser>): Array<Parser> {
* The Fluent rules must come right after the space rules, otherwise it
* generates a lot of false positives.
*/
const WithPlaceablesForFluent: any = createMarker(getRulesWithFluent(rules));
export default WithPlaceablesForFluent;
export const WithPlaceablesForFluent: any = createMarker(
getRulesWithFluent(rules),
);

Просмотреть файл

@ -12,8 +12,6 @@ import { getRulesWithoutLeadingSpace } from './WithPlaceablesNoLeadingSpace';
*
* See ./WithPlaceablesNoLeadingSpace.js for documentation.
*/
const WithPlaceablesForFluentNoLeadingSpace: any = createMarker(
export const WithPlaceablesForFluentNoLeadingSpace: any = createMarker(
getRulesWithFluent(getRulesWithoutLeadingSpace(rules)),
);
export default WithPlaceablesForFluentNoLeadingSpace;

Просмотреть файл

@ -1,7 +1,7 @@
import React from 'react';
import { shallow } from 'enzyme';
import WithPlaceablesNoLeadingSpace from './WithPlaceablesNoLeadingSpace';
import { WithPlaceablesNoLeadingSpace } from './WithPlaceablesNoLeadingSpace';
describe('<WithPlaceablesNoLeadingSpace>', () => {
it('matches newlines in a string', () => {

Просмотреть файл

@ -4,8 +4,8 @@ import type { Parser } from 'react-content-marker';
import './WithPlaceables.css';
import { rules } from './WithPlaceables';
import leadingSpace from '../parsers/leadingSpace';
import unusualSpace from '../parsers/unusualSpace';
import { leadingSpace } from '../parsers/leadingSpace';
import { unusualSpace } from '../parsers/unusualSpace';
export function getRulesWithoutLeadingSpace(
rules: Array<Parser>,
@ -27,8 +27,6 @@ export function getRulesWithoutLeadingSpace(
* have a special Placeables component without that parser, for use in
* combination with other parsing tools (like diff).
*/
const WithPlaceablesNoLeadingSpace: any = createMarker(
export const WithPlaceablesNoLeadingSpace: any = createMarker(
getRulesWithoutLeadingSpace(rules),
);
export default WithPlaceablesNoLeadingSpace;

Просмотреть файл

@ -1,14 +1,10 @@
export { default as WithPlaceables } from './components/WithPlaceables';
export { WithPlaceables } from './components/WithPlaceables';
export { rules } from './components/WithPlaceables';
export { default as WithPlaceablesForFluent } from './components/WithPlaceablesForFluent';
export { WithPlaceablesForFluent } from './components/WithPlaceablesForFluent';
export { getRulesWithFluent } from './components/WithPlaceablesForFluent';
export { default as WithPlaceablesNoLeadingSpace } from './components/WithPlaceablesNoLeadingSpace';
export { WithPlaceablesNoLeadingSpace } from './components/WithPlaceablesNoLeadingSpace';
export { getRulesWithoutLeadingSpace } from './components/WithPlaceablesNoLeadingSpace';
export { default as WithPlaceablesForFluentNoLeadingSpace } from './components/WithPlaceablesForFluentNoLeadingSpace';
// Name of this module.
// Used as the key to store this module's reducer.
export const NAME = 'placeable';
export { WithPlaceablesForFluentNoLeadingSpace } from './components/WithPlaceablesForFluentNoLeadingSpace';

Просмотреть файл

@ -3,7 +3,7 @@ import { shallow } from 'enzyme';
import createMarker from 'react-content-marker';
import altAttribute from './altAttribute';
import { altAttribute } from './altAttribute';
describe('altAttribute', () => {
it('marks the right parts of a string', () => {

Просмотреть файл

@ -1,5 +1,5 @@
import * as React from 'react';
import { Localized } from '@fluent/react';
import React from 'react';
/**
* Marks `alt` attributes and their values inside XML tags.
@ -12,7 +12,7 @@ import { Localized } from '@fluent/react';
* Source:
* https://github.com/translate/translate/blob/2.3.1/translate/storage/placeables/general.py#L55
*/
const altAttribute = {
export const altAttribute = {
rule: /(alt=".*?")/i as RegExp,
tag: (x: string): React.ReactElement<React.ElementType> => {
return (
@ -28,5 +28,3 @@ const altAttribute = {
);
},
};
export default altAttribute;

Просмотреть файл

@ -4,7 +4,7 @@ import each from 'jest-each';
import createMarker from 'react-content-marker';
import camelCaseString from './camelCaseString';
import { camelCaseString } from './camelCaseString';
describe('camelCaseString', () => {
each([

Просмотреть файл

@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';
import { Localized } from '@fluent/react';
/**
@ -13,7 +13,7 @@ import { Localized } from '@fluent/react';
* Source:
* https://github.com/translate/translate/blob/2.3.1/translate/storage/placeables/general.py#L274
*/
const camelCaseString = {
export const camelCaseString = {
rule: /(\b([a-z]+[A-Z]|[A-Z]+[a-z]+[A-Z]|[A-Z]{2,}[a-z])[a-zA-Z0-9]*\b)/ as RegExp,
matchIndex: 0,
tag: (x: string): React.ReactElement<React.ElementType> => {
@ -26,5 +26,3 @@ const camelCaseString = {
);
},
};
export default camelCaseString;

Просмотреть файл

@ -4,7 +4,7 @@ import each from 'jest-each';
import createMarker from 'react-content-marker';
import emailPattern from './emailPattern';
import { emailPattern } from './emailPattern';
describe('emailPattern', () => {
each([

Просмотреть файл

@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';
import { Localized } from '@fluent/react';
/**
@ -13,7 +13,7 @@ import { Localized } from '@fluent/react';
* Source:
* https://github.com/translate/translate/blob/2.3.1/translate/storage/placeables/general.py#L220
*/
const emailPattern = {
export const emailPattern = {
rule: /(((mailto:)|)[A-Za-z0-9]+[-a-zA-Z0-9._%]*@(([-A-Za-z0-9]+)\.)+[a-zA-Z]{2,4})/ as RegExp,
matchIndex: 0,
tag: (x: string): React.ReactElement<React.ElementType> => {
@ -26,5 +26,3 @@ const emailPattern = {
);
},
};
export default emailPattern;

Просмотреть файл

@ -3,7 +3,7 @@ import { shallow } from 'enzyme';
import createMarker from 'react-content-marker';
import escapeSequence from './escapeSequence';
import { escapeSequence } from './escapeSequence';
describe('escapeSequence', () => {
it('marks the right parts of a string', () => {

Просмотреть файл

@ -1,10 +1,10 @@
import * as React from 'react';
import React from 'react';
import { Localized } from '@fluent/react';
/**
* Marks the escape character "\".
*/
const escapeSequence = {
export const escapeSequence = {
rule: '\\',
tag: (x: string): React.ReactElement<React.ElementType> => {
return (
@ -16,5 +16,3 @@ const escapeSequence = {
);
},
};
export default escapeSequence;

Просмотреть файл

@ -4,7 +4,7 @@ import each from 'jest-each';
import createMarker from 'react-content-marker';
import filePattern from './filePattern';
import { filePattern } from './filePattern';
describe('filePattern', () => {
each([

Просмотреть файл

@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';
import { Localized } from '@fluent/react';
/**
@ -13,7 +13,7 @@ import { Localized } from '@fluent/react';
* Source:
* https://github.com/translate/translate/blob/2.3.1/translate/storage/placeables/general.py#L208
*/
const filePattern = {
export const filePattern = {
rule: /(^|\s)((~\/|\/|\.\/)([-A-Za-z0-9_$.+!*(),;:@&=?/~#%]|\\){3,})/ as RegExp,
matchIndex: 2,
tag: (x: string): React.ReactElement<React.ElementType> => {
@ -26,5 +26,3 @@ const filePattern = {
);
},
};
export default filePattern;

Просмотреть файл

@ -3,7 +3,7 @@ import createMarker from 'react-content-marker';
import { shallow } from 'enzyme';
import each from 'jest-each';
import fluentFunction from './fluentFunction';
import { fluentFunction } from './fluentFunction';
describe('fluentFunction', () => {
each([

Просмотреть файл

@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';
import { Localized } from '@fluent/react';
/**
@ -12,7 +12,7 @@ import { Localized } from '@fluent/react';
* { DATETIME($date) }
* { NUMBER($ratio, minimumFractionDigits: 2) }
*/
const fluentFunction = {
export const fluentFunction = {
rule: /({ ?[A-W0-9\-_]+[^}]* ?})/ as RegExp,
tag: (x: string): React.ReactElement<React.ElementType> => {
return (
@ -24,5 +24,3 @@ const fluentFunction = {
);
},
};
export default fluentFunction;

Просмотреть файл

@ -3,7 +3,7 @@ import createMarker from 'react-content-marker';
import { shallow } from 'enzyme';
import each from 'jest-each';
import fluentParametrizedTerm from './fluentParametrizedTerm';
import { fluentParametrizedTerm } from './fluentParametrizedTerm';
describe('fluentParametrizedTerm', () => {
each([

Просмотреть файл

@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';
import { Localized } from '@fluent/react';
/**
@ -12,7 +12,7 @@ import { Localized } from '@fluent/react';
* { -brand(case: "what ever") }
* { -brand-name(foo-bar: "now that's a value!") }
*/
const fluentParametrizedTerm = {
export const fluentParametrizedTerm = {
rule: /({ ?-[^}]*([^}]*: ?[^}]*) ?})/ as RegExp,
matchIndex: 1,
tag: (x: string): React.ReactElement<React.ElementType> => {
@ -28,5 +28,3 @@ const fluentParametrizedTerm = {
);
},
};
export default fluentParametrizedTerm;

Просмотреть файл

@ -3,7 +3,7 @@ import createMarker from 'react-content-marker';
import { shallow } from 'enzyme';
import each from 'jest-each';
import fluentString from './fluentString';
import { fluentString } from './fluentString';
describe('fluentString', () => {
each([

Просмотреть файл

@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';
import { Localized } from '@fluent/react';
/**
@ -11,7 +11,7 @@ import { Localized } from '@fluent/react';
* { "" }
* { "Hello, World" }
*/
const fluentString = {
export const fluentString = {
rule: /({ ?"[^}]*" ?})/ as RegExp,
tag: (x: string): React.ReactElement<React.ElementType> => {
return (
@ -23,5 +23,3 @@ const fluentString = {
);
},
};
export default fluentString;

Просмотреть файл

@ -3,7 +3,7 @@ import createMarker from 'react-content-marker';
import { shallow } from 'enzyme';
import each from 'jest-each';
import fluentTerm from './fluentTerm';
import { fluentTerm } from './fluentTerm';
describe('fluentTerm', () => {
each([

Просмотреть файл

@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';
import { Localized } from '@fluent/react';
/**
@ -12,7 +12,7 @@ import { Localized } from '@fluent/react';
* { -brand }
* { -brand-name }
*/
const fluentTerm = {
export const fluentTerm = {
rule: /({ ?-[^}]* ?})/ as RegExp,
tag: (x: string): React.ReactElement<React.ElementType> => {
return (
@ -24,5 +24,3 @@ const fluentTerm = {
);
},
};
export default fluentTerm;

Просмотреть файл

@ -4,7 +4,7 @@ import each from 'jest-each';
import createMarker from 'react-content-marker';
import javaFormattingVariable from './javaFormattingVariable';
import { javaFormattingVariable } from './javaFormattingVariable';
describe('javaFormattingVariable', () => {
each([

Просмотреть файл

@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';
import { Localized } from '@fluent/react';
/**
@ -21,7 +21,7 @@ import { Localized } from '@fluent/react';
* Source:
* https://github.com/translate/translate/blob/2.3.1/translate/storage/placeables/general.py#L127
*/
const javaFormattingVariable = {
export const javaFormattingVariable = {
rule: /({[0-9]+(,\s*(number(,\s*(integer|currency|percent|[-0#.,E;%\u2030\u00a4']+)?)?|(date|time)(,\s*(short|medium|long|full|.+?))?|choice,([^{]+({.+})?)+)?)?})/ as RegExp,
matchIndex: 0,
tag: (x: string): React.ReactElement<React.ElementType> => {
@ -41,5 +41,3 @@ const javaFormattingVariable = {
);
},
};
export default javaFormattingVariable;

Просмотреть файл

@ -4,7 +4,7 @@ import each from 'jest-each';
import createMarker from 'react-content-marker';
import jsonPlaceholder from './jsonPlaceholder';
import { jsonPlaceholder } from './jsonPlaceholder';
describe('jsonPlaceholder', () => {
each([

Просмотреть файл

@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';
import { Localized } from '@fluent/react';
/**
@ -12,7 +12,7 @@ import { Localized } from '@fluent/react';
* $USER$
* $FIRST_NAME$
*/
const jsonPlaceholder = {
export const jsonPlaceholder = {
rule: /(\$[A-Z0-9_]+\$)/ as RegExp,
tag: (x: string): React.ReactElement<React.ElementType> => {
return (
@ -24,5 +24,3 @@ const jsonPlaceholder = {
);
},
};
export default jsonPlaceholder;

Просмотреть файл

@ -4,7 +4,7 @@ import each from 'jest-each';
import createMarker from 'react-content-marker';
import leadingSpace from './leadingSpace';
import { leadingSpace } from './leadingSpace';
describe('leadingSpace', () => {
each([[' ', ' hello world']]).it('marks `%s` in `%s`', (mark, content) => {

Просмотреть файл

@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';
import { Localized } from '@fluent/react';
/**
@ -8,7 +8,7 @@ import { Localized } from '@fluent/react';
*
* " Hello, world"
*/
const leadingSpace = {
export const leadingSpace = {
rule: /(^ +)/ as RegExp,
tag: (x: string): React.ReactElement<React.ElementType> => {
return (
@ -20,5 +20,3 @@ const leadingSpace = {
);
},
};
export default leadingSpace;

Просмотреть файл

@ -3,7 +3,7 @@ import { shallow } from 'enzyme';
import createMarker from 'react-content-marker';
import multipleSpaces from './multipleSpaces';
import { multipleSpaces } from './multipleSpaces';
describe('multipleSpaces', () => {
it('marks the right parts of a string', () => {

Просмотреть файл

@ -1,10 +1,10 @@
import * as React from 'react';
import React from 'react';
import { Localized } from '@fluent/react';
/**
* Marks multiple consecutive spaces and replaces them with a middle dot.
*/
const multipleSpaces = {
export const multipleSpaces = {
rule: /( +)/ as RegExp,
tag: (x: string): React.ReactElement<React.ElementType> => {
return (
@ -22,5 +22,3 @@ const multipleSpaces = {
);
},
};
export default multipleSpaces;

Просмотреть файл

@ -3,7 +3,7 @@ import { shallow } from 'enzyme';
import createMarker from 'react-content-marker';
import narrowNonBreakingSpace from './narrowNonBreakingSpace';
import { narrowNonBreakingSpace } from './narrowNonBreakingSpace';
describe('narrowNonBreakingSpace', () => {
it('marks the right parts of a string', () => {

Просмотреть файл

@ -1,10 +1,10 @@
import * as React from 'react';
import React from 'react';
import { Localized } from '@fluent/react';
/**
* Marks the narrow no-break space character (Unicode U+202F).
*/
const narrowNonBreakingSpace = {
export const narrowNonBreakingSpace = {
rule: /([\u202F])/ as RegExp,
tag: (x: string): React.ReactElement<React.ElementType> => {
return (
@ -19,5 +19,3 @@ const narrowNonBreakingSpace = {
);
},
};
export default narrowNonBreakingSpace;

Просмотреть файл

@ -3,7 +3,7 @@ import { shallow } from 'enzyme';
import createMarker from 'react-content-marker';
import newlineCharacter from './newlineCharacter';
import { newlineCharacter } from './newlineCharacter';
describe('newlineCharacter', () => {
it('marks the right parts of a string', () => {

Просмотреть файл

@ -1,10 +1,10 @@
import * as React from 'react';
import React from 'react';
import { Localized } from '@fluent/react';
/**
* Marks the newline character "\n".
*/
const newlineCharacter = {
export const newlineCharacter = {
rule: '\n',
tag: (x: string): React.ReactElement<React.ElementType> => {
return (
@ -22,5 +22,3 @@ const newlineCharacter = {
);
},
};
export default newlineCharacter;

Просмотреть файл

@ -3,7 +3,7 @@ import { shallow } from 'enzyme';
import createMarker from 'react-content-marker';
import newlineEscape from './newlineEscape';
import { newlineEscape } from './newlineEscape';
describe('newlineEscape', () => {
it('marks the right parts of a string', () => {

Просмотреть файл

@ -1,10 +1,10 @@
import * as React from 'react';
import React from 'react';
import { Localized } from '@fluent/react';
/**
* Marks escaped newline characters.
*/
const newlineEscape = {
export const newlineEscape = {
rule: '\\n',
tag: (x: string): React.ReactElement<React.ElementType> => {
return (
@ -16,5 +16,3 @@ const newlineEscape = {
);
},
};
export default newlineEscape;

Просмотреть файл

@ -3,7 +3,7 @@ import { shallow } from 'enzyme';
import createMarker from 'react-content-marker';
import nonBreakingSpace from './nonBreakingSpace';
import { nonBreakingSpace } from './nonBreakingSpace';
describe('nonBreakingSpace', () => {
it('marks the right parts of a string', () => {

Просмотреть файл

@ -1,10 +1,10 @@
import * as React from 'react';
import React from 'react';
import { Localized } from '@fluent/react';
/**
* Marks the no-break space character (Unicode U+00A0).
*/
const nonBreakingSpace = {
export const nonBreakingSpace = {
rule: '\u00A0',
tag: (x: string): React.ReactElement<React.ElementType> => {
return (
@ -16,5 +16,3 @@ const nonBreakingSpace = {
);
},
};
export default nonBreakingSpace;

Просмотреть файл

@ -4,7 +4,7 @@ import each from 'jest-each';
import createMarker from 'react-content-marker';
import nsisVariable from './nsisVariable';
import { nsisVariable } from './nsisVariable';
describe('nsisVariable', () => {
each([

Просмотреть файл

@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';
import { Localized } from '@fluent/react';
/**
@ -9,7 +9,7 @@ import { Localized } from '@fluent/react';
* $Brand
* $BrandShortName
*/
const nsisVariable = {
export const nsisVariable = {
rule: /(^|\s)(\$[a-zA-Z][\w]*)/ as RegExp,
matchIndex: 2,
tag: (x: string): React.ReactElement<React.ElementType> => {
@ -22,5 +22,3 @@ const nsisVariable = {
);
},
};
export default nsisVariable;

Просмотреть файл

@ -4,7 +4,7 @@ import each from 'jest-each';
import createMarker from 'react-content-marker';
import numberString from './numberString';
import { numberString } from './numberString';
describe('numberString', () => {
each([

Просмотреть файл

@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';
import { Localized } from '@fluent/react';
/**
@ -14,7 +14,7 @@ import { Localized } from '@fluent/react';
* Source:
* https://github.com/translate/translate/blob/2.3.1/translate/storage/placeables/general.py#L72
*/
const numberString = {
export const numberString = {
rule: /([-+]?[0-9]+([\u00A0.,][0-9]+)*)\b/u as RegExp,
matchIndex: 0,
tag: (x: string): React.ReactElement<React.ElementType> => {
@ -27,5 +27,3 @@ const numberString = {
);
},
};
export default numberString;

Просмотреть файл

@ -4,7 +4,7 @@ import each from 'jest-each';
import createMarker from 'react-content-marker';
import optionPattern from './optionPattern';
import { optionPattern } from './optionPattern';
describe('optionPattern', () => {
each([

Просмотреть файл

@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';
import { Localized } from '@fluent/react';
/**
@ -12,7 +12,7 @@ import { Localized } from '@fluent/react';
* Source:
* https://github.com/translate/translate/blob/2.3.1/translate/storage/placeables/general.py#L317
*/
const optionPattern = {
export const optionPattern = {
rule: /(\B(-[a-zA-Z]|--[a-z-]+)\b)/ as RegExp,
matchIndex: 0,
tag: (x: string): React.ReactElement<React.ElementType> => {
@ -25,5 +25,3 @@ const optionPattern = {
);
},
};
export default optionPattern;

Просмотреть файл

@ -4,7 +4,7 @@ import each from 'jest-each';
import createMarker from 'react-content-marker';
import punctuation from './punctuation';
import { punctuation } from './punctuation';
describe('punctuation', () => {
each([

Просмотреть файл

@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';
import { Localized } from '@fluent/react';
/**
@ -7,7 +7,7 @@ import { Localized } from '@fluent/react';
* Source:
* https://github.com/translate/translate/blob/2.3.1/translate/storage/placeables/general.py#L229
*/
const punctuation = {
export const punctuation = {
rule: new RegExp(
'(' +
'(' +
@ -35,5 +35,3 @@ const punctuation = {
);
},
};
export default punctuation;

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше