Optimize eslint

master
Jerome Wu 4 years ago
parent e883f87ab7
commit 920dd902f8
  1. 2
      .eslintrc
  2. 1263
      package-lock.json
  3. 9
      package.json
  4. 2
      src/createWorker.js
  5. 4
      src/worker-script/browser/cache.js
  6. 4
      src/worker-script/browser/index.js
  7. 4
      src/worker-script/index.js
  8. 6
      src/worker-script/node/cache.js
  9. 4
      src/worker-script/node/index.js
  10. 4
      src/worker-script/utils/dump.js
  11. 6
      src/worker/browser/loadImage.js

@ -1,5 +1,5 @@
{
"extends": "airbnb",
"extends": "airbnb-base",
"env": {
"browser": true,
"node": true,

1263
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -23,6 +23,7 @@
"test:browser:scheduler": "npm run test:browser-tpl -- -f ./tests/scheduler.test.html",
"test:browser:FS": "npm run test:browser-tpl -- -f ./tests/FS.test.html",
"lint": "eslint src",
"lint:fix": "eslint --fix src",
"postinstall": "opencollective-postinstall || true"
},
"browser": {
@ -39,11 +40,9 @@
"acorn": "^6.4.0",
"babel-loader": "^8.1.0",
"cors": "^2.8.5",
"eslint": "^5.16.0",
"eslint-config-airbnb": "^17.1.1",
"eslint-plugin-import": "^2.19.1",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.17.0",
"eslint": "^7.2.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-plugin-import": "^2.22.1",
"expect.js": "^0.3.1",
"express": "^4.17.1",
"mocha": "^5.2.0",

@ -53,7 +53,7 @@ module.exports = (_options = {}) => {
})
);
const load = jobId => (
const load = (jobId) => (
startJob(createJob({
id: jobId, action: 'load', payload: { options },
}))

@ -4,7 +4,7 @@ module.exports = {
readCache: get,
writeCache: set,
deleteCache: del,
checkCache: path => (
get(path).then(v => typeof v !== 'undefined')
checkCache: (path) => (
get(path).then((v) => typeof v !== 'undefined')
),
};

@ -8,7 +8,7 @@
* @author Jerome Wu <jeromewus@gmail.com>
*/
const worker = require('../');
const worker = require('..');
const getCore = require('./getCore');
const gunzip = require('./gunzip');
const cache = require('./cache');
@ -17,7 +17,7 @@ const cache = require('./cache');
* register message handler
*/
global.addEventListener('message', ({ data }) => {
worker.dispatchHandlers(data, obj => postMessage(obj));
worker.dispatchHandlers(data, (obj) => postMessage(obj));
});
/*

@ -154,7 +154,7 @@ const loadLanguage = async ({
const setParameters = ({ payload: { params: _params } }, res) => {
Object.keys(_params)
.filter(k => !k.startsWith('tessjs_'))
.filter((k) => !k.startsWith('tessjs_'))
.forEach((key) => {
api.SetVariable(key, _params[key]);
});
@ -171,7 +171,7 @@ const initialize = ({
}, res) => {
const langs = (typeof _langs === 'string')
? _langs
: _langs.map(l => ((typeof l === 'string') ? l : l.data)).join('+');
: _langs.map((l) => ((typeof l === 'string') ? l : l.data)).join('+');
try {
res.progress({

@ -4,13 +4,13 @@ const fs = require('fs');
module.exports = {
readCache: util.promisify(fs.readFile),
writeCache: util.promisify(fs.writeFile),
deleteCache: path => (
deleteCache: (path) => (
util.promisify(fs.unlink)(path)
.catch(() => {})
),
checkCache: path => (
checkCache: (path) => (
util.promisify(fs.access)(path, fs.F_OK)
.then(err => (err === null))
.then((err) => (err === null))
.catch(() => false)
),
};

@ -9,7 +9,7 @@
*/
const fetch = require('node-fetch');
const worker = require('../');
const worker = require('..');
const getCore = require('./getCore');
const gunzip = require('./gunzip');
const cache = require('./cache');
@ -18,7 +18,7 @@ const cache = require('./cache');
* register message handler
*/
process.on('message', (packet) => {
worker.dispatchHandlers(packet, obj => process.send(obj));
worker.dispatchHandlers(packet, (obj) => process.send(obj));
});
worker.setAdapter({

@ -61,8 +61,8 @@ module.exports = (TessModule, api, {
const enumToString = (value, prefix) => (
Object.keys(TessModule)
.filter(e => (e.startsWith(`${prefix}_`) && TessModule[e] === value))
.map(e => e.slice(prefix.length + 1))[0]
.filter((e) => (e.startsWith(`${prefix}_`) && TessModule[e] === value))
.map((e) => e.slice(prefix.length + 1))[0]
);
ri.Begin();

@ -8,7 +8,7 @@ const blueimpLoadImage = require('blueimp-load-image');
* @function
* @access private
*/
const readFromBlobOrFile = blob => (
const readFromBlobOrFile = (blob) => (
new Promise((resolve, reject) => {
const fileReader = new FileReader();
fileReader.onload = () => {
@ -21,11 +21,11 @@ const readFromBlobOrFile = blob => (
})
);
const fixOrientationFromUrlOrBlobOrFile = blob => (
const fixOrientationFromUrlOrBlobOrFile = (blob) => (
new Promise((resolve) => {
blueimpLoadImage(
blob,
img => img.toBlob(resolve),
(img) => img.toBlob(resolve),
{
orientation: true,
canvas: true,

Loading…
Cancel
Save