mirror of
https://gitee.com/docsifyjs/docsify.git
synced 2024-11-29 18:48:14 +08:00
62d756c447
BREAKING: The new project layout might break in some tooling setups. We've added an exports field to `package.json` to specify where statements like `import ... from 'docsify'` will import from, and left the `main` and `unpkg` fields as-is for backwards compatibility with the global <script> import method. Most people who use a non-module `<script>` tag to import Docsify will not notice a difference. Anyone else who is importing Docsify into a specilized build setup using `import` statements has a chance of being broken, so we've marked this as BREAKING.
84 lines
2.0 KiB
JavaScript
84 lines
2.0 KiB
JavaScript
const prettierConfig = require('./.prettierrc.json');
|
|
|
|
module.exports = {
|
|
root: true,
|
|
extends: [
|
|
'eslint:recommended',
|
|
'plugin:import/recommended',
|
|
'plugin:prettier/recommended', // Must be last
|
|
],
|
|
parser: '@babel/eslint-parser',
|
|
parserOptions: {
|
|
sourceType: 'module',
|
|
ecmaVersion: 2019,
|
|
},
|
|
plugins: ['prettier', 'import'],
|
|
env: {
|
|
browser: true,
|
|
es6: true,
|
|
node: true,
|
|
},
|
|
settings: {
|
|
'import/ignore': ['node_modules', '.json$'],
|
|
},
|
|
rules: {
|
|
camelcase: ['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-restricted-names': ['error'],
|
|
'no-shadow': [
|
|
'error',
|
|
{
|
|
allow: [
|
|
'Events',
|
|
'Fetch',
|
|
'Lifecycle',
|
|
'Render',
|
|
'Router',
|
|
'VirtualRoutes',
|
|
],
|
|
},
|
|
],
|
|
'no-unused-vars': ['error', { args: 'none' }],
|
|
'no-useless-call': ['error'],
|
|
'no-useless-escape': ['warn'],
|
|
'no-var': ['error'],
|
|
'no-void': ['error'],
|
|
'no-with': ['error'],
|
|
radix: ['error'],
|
|
'spaced-comment': ['error', 'always'],
|
|
strict: ['error', 'global'],
|
|
yoda: ['error', 'never'],
|
|
|
|
// Import rules
|
|
'import/imports-first': ['error'],
|
|
'import/newline-after-import': ['error'],
|
|
'import/no-duplicates': ['error'],
|
|
'import/no-mutable-exports': ['error'],
|
|
'import/no-named-as-default-member': ['error'],
|
|
'import/no-named-as-default': ['error'],
|
|
'import/no-unresolved': 'off',
|
|
'import/order': ['warn'],
|
|
|
|
// Prettier (Must be last)
|
|
'prettier/prettier': ['warn', prettierConfig],
|
|
},
|
|
globals: {
|
|
$docsify: 'writable',
|
|
Docsify: 'writable',
|
|
dom: 'writable',
|
|
},
|
|
};
|