mirror of
https://gitee.com/docsifyjs/docsify.git
synced 2024-11-29 18:48:14 +08:00
136e666e78
* develop: (104 commits) chore: bump ssri from 6.0.1 to 6.0.2 (#1563) chore: Update Edit Document using develop branch (#1541) fix: Add escapeHtml for search (#1551) docs: link with plugin Pagination (#1554) fix: Upgrade dompurify from 2.2.6 to 2.2.7 (#1553) fix: upgrade dompurify from 2.2.6 to 2.2.7 (#1552) chore: bump y18n from 4.0.0 to 4.0.1 (#1548) chore: Fix search for missing pathNamespaces (#1547) fix: Upgrade docsify from 4.12.0 to 4.12.1 (#1544) docs:Update deploy, change Zeit to Vercel (#1540) fix: Cannot read property 'classList' of null (#1527) chore: fix microsoft/playwright-github-action error (#1534) Update PULL_REQUEST_TEMPLATE.md chore: Update CHANGELOG and Update test snapshots chore: add changelog 4.12.1 [build] 4.12.1 feat: Support search when there is no title (#1519) test(unit): add test cases on isExternal. (#1515) docs: Update Vercel logo link (#1520) fix: Upgrade docsify from 4.11.6 to 4.12.0 (#1518) ...
93 lines
2.4 KiB
JavaScript
93 lines
2.4 KiB
JavaScript
const deasync = require('deasync'); // powerful magic
|
|
|
|
const promiseSync = deasync((promise, cb) => {
|
|
promise.then(result => cb(null, result)).catch(error => cb(error));
|
|
});
|
|
|
|
const importSync = name => promiseSync(import(name));
|
|
|
|
// Look, no await needed here!
|
|
const jestConfig = importSync('./jest.config.js').default;
|
|
const jestGlobals = {};
|
|
|
|
for (const key of Object.keys(jestConfig.globals)) {
|
|
jestGlobals[key] = 'readonly';
|
|
}
|
|
|
|
module.exports = {
|
|
root: true,
|
|
parser: 'babel-eslint',
|
|
parserOptions: {
|
|
sourceType: 'module',
|
|
ecmaVersion: 2019,
|
|
},
|
|
env: {
|
|
browser: true,
|
|
node: true,
|
|
es6: true,
|
|
},
|
|
plugins: ['prettier', 'import'],
|
|
extends: ['eslint:recommended', 'plugin:import/recommended'],
|
|
settings: {
|
|
'import/ignore': ['node_modules', '.json$'],
|
|
},
|
|
rules: {
|
|
'prettier/prettier': ['error'],
|
|
camelcase: ['warn'],
|
|
'no-useless-escape': ['warn'],
|
|
curly: ['error', 'all'],
|
|
'dot-notation': ['error'],
|
|
eqeqeq: ['error'],
|
|
'handle-callback-err': ['error'],
|
|
'new-cap': ['error'],
|
|
'no-alert': ['error'],
|
|
'no-caller': ['error'],
|
|
'no-eval': ['error'],
|
|
'no-labels': ['error'],
|
|
'no-lonely-if': ['error'],
|
|
'no-new': ['error'],
|
|
'no-proto': ['error'],
|
|
'no-return-assign': ['error'],
|
|
'no-self-compare': ['error'],
|
|
'no-shadow': ['warn'],
|
|
'no-shadow-restricted-names': ['error'],
|
|
'no-useless-call': ['error'],
|
|
'no-var': ['error'],
|
|
'no-void': ['error'],
|
|
'no-with': ['error'],
|
|
'no-prototype-builtins': 'off',
|
|
radix: ['error'],
|
|
'spaced-comment': ['error', 'always'],
|
|
strict: ['error', 'global'],
|
|
yoda: ['error', 'never'],
|
|
|
|
// Import rules
|
|
// Search way how integrate with `lerna`
|
|
'import/no-unresolved': 'off',
|
|
'import/imports-first': ['error'],
|
|
'import/newline-after-import': ['error'],
|
|
'import/no-duplicates': ['error'],
|
|
'import/no-mutable-exports': ['error'],
|
|
'import/no-named-as-default': ['error'],
|
|
'import/no-named-as-default-member': ['error'],
|
|
'import/order': ['warn'],
|
|
},
|
|
globals: {
|
|
Docsify: 'writable',
|
|
$docsify: 'writable',
|
|
dom: 'writable',
|
|
},
|
|
|
|
overrides: [
|
|
{
|
|
files: ['test/**/*.js', '**/*.test.js'],
|
|
extends: ['plugin:jest/recommended', 'plugin:jest/style'],
|
|
globals: jestGlobals,
|
|
},
|
|
{
|
|
files: ['test/e2e/**/*.test.js'],
|
|
extends: ['plugin:jest-playwright/recommended'],
|
|
},
|
|
],
|
|
};
|