ui: add option for autoFormat

pull/96/head
undefined 4 years ago
parent 5db35700f3
commit 994634947e

@ -7,24 +7,24 @@ globals:
Atomics: readonly Atomics: readonly
SharedArrayBuffer: readonly SharedArrayBuffer: readonly
BigInt: readonly BigInt: readonly
parser: "@typescript-eslint/parser" parser: '@typescript-eslint/parser'
plugins: plugins:
- "@typescript-eslint" - '@typescript-eslint'
rules: rules:
"@typescript-eslint/dot-notation": 0 '@typescript-eslint/dot-notation': 0
"@typescript-eslint/no-implied-eval": 0 '@typescript-eslint/no-implied-eval': 0
"@typescript-eslint/no-throw-literal": 0 '@typescript-eslint/no-throw-literal': 0
"@typescript-eslint/return-await": 0 '@typescript-eslint/return-await': 0
"@typescript-eslint/indent": '@typescript-eslint/indent':
- warn - warn
- 4 - 4
"@typescript-eslint/lines-between-class-members": '@typescript-eslint/lines-between-class-members':
- error - error
- always - always
- exceptAfterSingleLine: true - exceptAfterSingleLine: true
"@typescript-eslint/naming-convention": 0 '@typescript-eslint/naming-convention': 0
"@typescript-eslint/no-redeclare": 0 '@typescript-eslint/no-redeclare': 0
class-methods-use-this: 0 class-methods-use-this: 0
global-require: 0 global-require: 0
@ -55,7 +55,7 @@ rules:
prefer-destructuring: 0 prefer-destructuring: 0
settings: settings:
import/parsers: import/parsers:
"@typescript-eslint/parser": '@typescript-eslint/parser':
- .ts - .ts
- .js - .js
- .jsx - .jsx

@ -5,7 +5,7 @@ import Notification from 'vj/components/notification/index';
const highlighterPage = new AutoloadPage('highlighterPage', async () => { const highlighterPage = new AutoloadPage('highlighterPage', async () => {
const [{ default: prismjs }, [success, format]] = await Promise.all([ const [{ default: prismjs }, [success, format]] = await Promise.all([
import('./prismjs'), import('./prismjs'),
load(), UserContext.formatCode ? load() : [true, null],
]); ]);
if (!success) Notification.error(`Astyle load fail: ${format}`); if (!success) Notification.error(`Astyle load fail: ${format}`);
function runHighlight($container) { function runHighlight($container) {

@ -86,6 +86,12 @@ showInvisibleChar:
family: highlight family: highlight
desc: show invisible characters when formatting code desc: show invisible characters when formatting code
category: preference category: preference
formatCode:
type: boolean
family: highlight
desc: Auto format code
category: preference
value: true
astyleOptions: astyleOptions:
type: text type: text
family: highlight family: highlight

Loading…
Cancel
Save