From bde2c50e3ed98bcb0d3e16fabe4fbd1019da0495 Mon Sep 17 00:00:00 2001 From: pmario Date: Fri, 7 Jul 2023 22:45:13 +0200 Subject: [PATCH] dprint.json seems to be OK, some forgotten functions --- .eslintignore | 2 + .eslintrc.json | 317 ++++++++++++++++++ .eslintrc.yml | 283 ---------------- dprint.json | 32 ++ .../javascript-widget-tutorial/domwidget.js | 1 - .../hello-attribute-optimized.js | 4 +- .../hello-attribute.js | 2 - .../refreshcount.js | 2 - .../tiddlerfield-norefresh.js | 2 - .../tiddlerfield.js | 2 - package.json | 70 ++-- .../tiddlywiki/browser-storage/rawmarkup.js | 7 +- .../highlight-legacy/highlightblock.js | 8 +- 13 files changed, 392 insertions(+), 340 deletions(-) create mode 100644 .eslintrc.json delete mode 100644 .eslintrc.yml create mode 100644 dprint.json diff --git a/.eslintignore b/.eslintignore index 9e586b92e..7c5774456 100644 --- a/.eslintignore +++ b/.eslintignore @@ -6,3 +6,5 @@ /core/modules/utils/diff-match-patch/diff_match_patch_uncompressed.js /core/modules/utils/dom/csscolorparser.js /plugins/tiddlywiki/*/files/ +/tmp/ +/output/ diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 000000000..cbcea998b --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,317 @@ +{ + "env": { + "browser": true, + "commonjs": true, + "node": true + }, + "extends": [ + "eslint:recommended" + ], + "globals": { + "$tw": "writable" + }, + "parserOptions": { + "ecmaVersion": 5 + }, + "plugins": [], + "rules": { + "array-bracket-newline": "off", + "array-bracket-spacing": "off", + "array-callback-return": "off", + "array-element-newline": "off", + "arrow-body-style": "error", + "arrow-parens": [ + "error", + "as-needed" + ], + "arrow-spacing": [ + "error", + { + "after": true, + "before": true + } + ], + "block-scoped-var": "off", + "block-spacing": "off", + "brace-style": "off", + "callback-return": "off", + "camelcase": "off", + "capitalized-comments": "off", + "class-methods-use-this": "error", + "comma-dangle": "off", + "comma-spacing": "off", + "comma-style": "off", + "complexity": "off", + "computed-property-spacing": "off", + "consistent-return": "off", + "consistent-this": "off", + "curly": "off", + "default-case": "off", + "default-case-last": "error", + "default-param-last": "error", + "dot-location": "off", + "dot-notation": "off", + "eol-last": "off", + "eqeqeq": "off", + "func-call-spacing": "off", + "func-name-matching": "off", + "func-names": "off", + "func-style": "off", + "function-call-argument-newline": "off", + "function-paren-newline": "off", + "generator-star-spacing": "error", + "global-require": "off", + "grouped-accessor-pairs": "error", + "guard-for-in": "off", + "handle-callback-err": "off", + "id-blacklist": "error", + "id-denylist": "error", + "id-length": "off", + "id-match": "error", + "implicit-arrow-linebreak": "error", + "indent": "off", + "indent-legacy": "off", + "init-declarations": "off", + "jsx-quotes": "error", + "key-spacing": "off", + "keyword-spacing": [ + "error", + { + "before": true, + "after": false, + "overrides": { + "case": { + "after": true + }, + "do": { + "after": true + }, + "else": { + "after": true + }, + "return": { + "after": true + }, + "throw": { + "after": true + }, + "try": { + "after": true + }, + "catch": { + "after": true + } + } + } + ], + "line-comment-position": "off", + "linebreak-style": "off", + "lines-around-comment": "off", + "lines-around-directive": "off", + "lines-between-class-members": "error", + "max-classes-per-file": "error", + "max-depth": "off", + "max-len": "off", + "max-lines": "off", + "max-lines-per-function": "off", + "max-nested-callbacks": "error", + "max-params": "off", + "max-statements": "off", + "max-statements-per-line": "off", + "multiline-comment-style": "off", + "multiline-ternary": "off", + "new-parens": "off", + "newline-after-var": "off", + "newline-before-return": "off", + "newline-per-chained-call": "off", + "no-alert": "off", + "no-array-constructor": "off", + "no-await-in-loop": "error", + "no-bitwise": "off", + "no-buffer-constructor": "off", + "no-caller": "error", + "no-catch-shadow": "off", + "no-confusing-arrow": "error", + "no-console": "off", + "no-constant-condition": [ + "error", + { + "checkLoops": false + } + ], + "no-constructor-return": "error", + "no-continue": "off", + "no-div-regex": "off", + "no-duplicate-imports": "error", + "no-else-return": "off", + "no-empty-function": "off", + "no-eq-null": "off", + "no-eval": "off", + "no-extend-native": "off", + "no-extra-bind": "off", + "no-extra-label": "off", + "no-extra-parens": "off", + "no-floating-decimal": "off", + "no-implicit-coercion": [ + "error", + { + "boolean": false, + "number": false, + "string": false + } + ], + "no-implicit-globals": "off", + "no-implied-eval": "error", + "no-inline-comments": "off", + "no-invalid-this": "off", + "no-iterator": "error", + "no-label-var": "off", + "no-labels": "off", + "no-lone-blocks": "off", + "no-lonely-if": "off", + "no-loop-func": "off", + "no-loss-of-precision": "error", + "no-magic-numbers": "off", + "no-mixed-operators": "off", + "no-mixed-requires": "off", + "no-multi-assign": "off", + "no-multi-spaces": "off", + "no-multi-str": "error", + "no-multiple-empty-lines": ["warn", { "max": 4, "maxEOF": 0 }], + "no-native-reassign": "off", + "no-negated-condition": "off", + "no-negated-in-lhs": "error", + "no-nested-ternary": "off", + "no-new": "off", + "no-new-func": "off", + "no-new-object": "off", + "no-new-require": "error", + "no-new-wrappers": "error", + "no-octal-escape": "error", + "no-param-reassign": "off", + "no-path-concat": "error", + "no-plusplus": "off", + "no-process-env": "off", + "no-process-exit": "off", + "no-promise-executor-return": "error", + "no-proto": "off", + "no-restricted-exports": "error", + "no-restricted-globals": "error", + "no-restricted-imports": "error", + "no-restricted-modules": "error", + "no-restricted-properties": "error", + "no-restricted-syntax": "error", + "no-return-assign": "off", + "no-return-await": "error", + "no-script-url": "off", + "no-self-compare": "off", + "no-sequences": "off", + "no-shadow": "off", + "no-spaced-func": "off", + "no-sync": "off", + "no-tabs": "off", + "no-template-curly-in-string": "error", + "no-ternary": "off", + "no-throw-literal": "off", + "no-trailing-spaces": "error", + "no-undef-init": "off", + "no-undefined": "off", + "no-underscore-dangle": "off", + "no-unmodified-loop-condition": "off", + "no-unneeded-ternary": "off", + "no-unreachable-loop": "error", + "no-unused-expressions": "off", + "no-use-before-define": "off", + "no-useless-backreference": "error", + "no-useless-call": "off", + "no-useless-computed-key": "error", + "no-useless-concat": "off", + "no-useless-constructor": "error", + "no-useless-rename": "error", + "no-useless-return": "off", + "no-var": "off", + "no-void": "off", + "no-warning-comments": "off", + "no-whitespace-before-property": "error", + "nonblock-statement-body-position": [ + "error", + "any" + ], + "object-curly-newline": "off", + "object-curly-spacing": "off", + "object-property-newline": "off", + "object-shorthand": "off", + "one-var": "off", + "one-var-declaration-per-line": "off", + "operator-assignment": "off", + "operator-linebreak": "off", + "padded-blocks": "off", + "padding-line-between-statements": "error", + "prefer-arrow-callback": "off", + "prefer-const": "off", + "prefer-destructuring": "off", + "prefer-exponentiation-operator": "off", + "prefer-named-capture-group": "off", + "prefer-numeric-literals": "error", + "prefer-object-spread": "off", + "prefer-promise-reject-errors": "error", + "prefer-reflect": "off", + "prefer-regex-literals": "off", + "prefer-rest-params": "off", + "prefer-spread": "off", + "prefer-template": "off", + "quote-props": "off", + "quotes": "off", + "radix": "off", + "require-atomic-updates": "error", + "require-await": "error", + "require-jsdoc": "off", + "require-unicode-regexp": "off", + "rest-spread-spacing": "error", + "semi": "off", + "semi-spacing": "off", + "semi-style": "off", + "sort-imports": "error", + "sort-keys": "off", + "sort-vars": "off", + "space-before-blocks": "off", + "space-before-function-paren": "off", + "space-in-parens": "off", + "space-infix-ops": "off", + "space-unary-ops": "off", + "spaced-comment": "off", + "strict": "off", + "switch-colon-spacing": "off", + "symbol-description": "error", + "template-curly-spacing": "error", + "template-tag-spacing": "error", + "unicode-bom": [ + "error", + "never" + ], + "valid-jsdoc": "off", + "valid-typeof": [ + "error", + { + "requireStringLiterals": false + } + ], + "vars-on-top": "off", + "wrap-iife": "off", + "wrap-regex": "off", + "yield-star-spacing": "error", + "yoda": "off", + "no-useless-escape": "off", + "no-unused-vars": "off", + "no-empty": "off", + "no-extra-semi": "off", + "no-redeclare": "off", + "no-control-regex": "off", + "no-mixed-spaces-and-tabs": "off", + "no-extra-boolean-cast": "off", + "no-prototype-builtins": "off", + "no-undef": "off", + "no-unreachable": "off", + "no-self-assign": "off" + } +} diff --git a/.eslintrc.yml b/.eslintrc.yml deleted file mode 100644 index 049af59e4..000000000 --- a/.eslintrc.yml +++ /dev/null @@ -1,283 +0,0 @@ -env: - browser: true - commonjs: true - es2021: true - node: true -extends: 'eslint:recommended' -globals: - "$tw": "writable" # temporary -parserOptions: - ecmaVersion: 5 -rules: - array-bracket-newline: 'off' - array-bracket-spacing: 'off' - array-callback-return: 'off' - array-element-newline: 'off' - arrow-body-style: error - arrow-parens: - - error - - as-needed - arrow-spacing: - - error - - after: true - before: true - block-scoped-var: 'off' - block-spacing: 'off' - brace-style: 'off' - callback-return: 'off' - camelcase: 'off' - capitalized-comments: 'off' - class-methods-use-this: error - comma-dangle: 'off' - comma-spacing: 'off' - comma-style: 'off' - complexity: 'off' - computed-property-spacing: 'off' - consistent-return: 'off' - consistent-this: 'off' - curly: 'off' - default-case: 'off' - default-case-last: error - default-param-last: error - dot-location: 'off' - dot-notation: 'off' - eol-last: 'off' - eqeqeq: 'off' - func-call-spacing: 'off' - func-name-matching: 'off' - func-names: 'off' - func-style: 'off' - function-call-argument-newline: 'off' - function-paren-newline: 'off' - generator-star-spacing: error - global-require: 'off' - grouped-accessor-pairs: error - guard-for-in: 'off' - handle-callback-err: 'off' - id-blacklist: error - id-denylist: error - id-length: 'off' - id-match: error - implicit-arrow-linebreak: error - indent: 'off' - indent-legacy: 'off' - init-declarations: 'off' - jsx-quotes: error - key-spacing: 'off' - keyword-spacing: - - error - - before: true - after: false - overrides: - 'case': - after: true - 'do': - 'after': true - 'else': - after: true - 'return': - after: true - 'throw': - after: true - 'try': - after: true - line-comment-position: 'off' - linebreak-style: 'off' - lines-around-comment: 'off' - lines-around-directive: 'off' - lines-between-class-members: error - max-classes-per-file: error - max-depth: 'off' - max-len: 'off' - max-lines: 'off' - max-lines-per-function: 'off' - max-nested-callbacks: error - max-params: 'off' - max-statements: 'off' - max-statements-per-line: 'off' - multiline-comment-style: 'off' - multiline-ternary: 'off' - new-parens: 'off' - newline-after-var: 'off' - newline-before-return: 'off' - newline-per-chained-call: 'off' - no-alert: 'off' - no-array-constructor: 'off' - no-await-in-loop: error - no-bitwise: 'off' - no-buffer-constructor: 'off' - no-caller: error - no-catch-shadow: 'off' - no-confusing-arrow: error - no-console: 'off' - no-constant-condition: - - error - - checkLoops: false - no-constructor-return: error - no-continue: 'off' - no-div-regex: 'off' - no-duplicate-imports: error - no-else-return: 'off' - no-empty-function: 'off' - no-eq-null: 'off' - no-eval: 'off' - no-extend-native: 'off' - no-extra-bind: 'off' - no-extra-label: 'off' - no-extra-parens: 'off' - no-floating-decimal: 'off' - no-implicit-coercion: - - error - - boolean: false - number: false - string: false - no-implicit-globals: 'off' - no-implied-eval: error - no-inline-comments: 'off' - no-invalid-this: 'off' - no-iterator: error - no-label-var: 'off' - no-labels: 'off' - no-lone-blocks: 'off' - no-lonely-if: 'off' - no-loop-func: 'off' - no-loss-of-precision: error - no-magic-numbers: 'off' - no-mixed-operators: 'off' - no-mixed-requires: 'off' - no-multi-assign: 'off' - no-multi-spaces: 'off' - no-multi-str: error - no-multiple-empty-lines: 'off' - no-native-reassign: 'off' - no-negated-condition: 'off' - no-negated-in-lhs: error - no-nested-ternary: 'off' - no-new: 'off' - no-new-func: 'off' - no-new-object: 'off' - no-new-require: error - no-new-wrappers: error - no-octal-escape: error - no-param-reassign: 'off' - no-path-concat: error - no-plusplus: 'off' - no-process-env: 'off' - no-process-exit: 'off' - no-promise-executor-return: error - no-proto: 'off' - no-restricted-exports: error - no-restricted-globals: error - no-restricted-imports: error - no-restricted-modules: error - no-restricted-properties: error - no-restricted-syntax: error - no-return-assign: 'off' - no-return-await: error - no-script-url: 'off' - no-self-compare: 'off' - no-sequences: 'off' - no-shadow: 'off' - no-spaced-func: 'off' - no-sync: 'off' - no-tabs: 'off' - no-template-curly-in-string: error - no-ternary: 'off' - no-throw-literal: 'off' - no-trailing-spaces: 'off' - no-undef-init: 'off' - no-undefined: 'off' - no-underscore-dangle: 'off' - no-unmodified-loop-condition: 'off' - no-unneeded-ternary: 'off' - no-unreachable-loop: error - no-unused-expressions: 'off' - no-use-before-define: 'off' - no-useless-backreference: error - no-useless-call: 'off' - no-useless-computed-key: error - no-useless-concat: 'off' - no-useless-constructor: error - no-useless-rename: error - no-useless-return: 'off' - no-var: 'off' - no-void: 'off' - no-warning-comments: 'off' - no-whitespace-before-property: error - nonblock-statement-body-position: - - error - - any - object-curly-newline: 'off' - object-curly-spacing: 'off' - object-property-newline: 'off' - object-shorthand: 'off' - one-var: 'off' - one-var-declaration-per-line: 'off' - operator-assignment: 'off' - operator-linebreak: 'off' - padded-blocks: 'off' - padding-line-between-statements: error - prefer-arrow-callback: 'off' - prefer-const: 'off' - prefer-destructuring: 'off' - prefer-exponentiation-operator: 'off' - prefer-named-capture-group: 'off' - prefer-numeric-literals: error - prefer-object-spread: 'off' - prefer-promise-reject-errors: error - prefer-reflect: 'off' - prefer-regex-literals: 'off' - prefer-rest-params: 'off' - prefer-spread: 'off' - prefer-template: 'off' - quote-props: 'off' - quotes: 'off' - radix: 'off' - require-atomic-updates: error - require-await: error - require-jsdoc: 'off' - require-unicode-regexp: 'off' - rest-spread-spacing: error - semi: 'off' - semi-spacing: 'off' - semi-style: 'off' - sort-imports: error - sort-keys: 'off' - sort-vars: 'off' - space-before-blocks: 'off' - space-before-function-paren: 'off' - space-in-parens: 'off' - space-infix-ops: 'off' - space-unary-ops: 'off' - spaced-comment: 'off' - strict: 'off' - switch-colon-spacing: 'off' - symbol-description: error - template-curly-spacing: error - template-tag-spacing: error - unicode-bom: - - error - - never - valid-jsdoc: 'off' - valid-typeof: - - error - - requireStringLiterals: false - vars-on-top: 'off' - wrap-iife: 'off' - wrap-regex: 'off' - yield-star-spacing: error - yoda: 'off' - - # temporary rules - no-useless-escape: 'off' - no-unused-vars: 'off' - no-empty: 'off' - no-extra-semi: 'off' - no-redeclare: 'off' - no-control-regex: "off" - no-mixed-spaces-and-tabs: "off" - no-extra-boolean-cast: "off" - no-prototype-builtins: "off" - no-undef: "off" - no-unreachable: "off" - no-self-assign: "off" diff --git a/dprint.json b/dprint.json new file mode 100644 index 000000000..3f82f28e2 --- /dev/null +++ b/dprint.json @@ -0,0 +1,32 @@ +{ + "lineWidth": 120, + "typescript": { + "quoteProps": "asNeeded", + "ifStatement.spaceAfterIfKeyword": false, + "forStatement.spaceAfterForKeyword": false, + "whileStatement.spaceAfterWhileKeyword": false, + "spaceSurroundingProperties": false, + "useTabs": true, + "indentWidth": 1, + "quoteStyle": "preferDouble", + "binaryExpression.operatorPosition": "sameLine", + "trailingCommas": "never", + "spaceAround": false + }, + "json": { + "useTabs": true, + "indentWidth": 1 + }, + "markdown": {}, + "includes": [ + "**/*.{js,json,md}", + "./*.json", + "./*.js" + ], + "excludes": ["**/node_modules", "**/*-lock.json", "**.min*", "sjcl.js"], + "plugins": [ + "https://plugins.dprint.dev/typescript-0.84.4.wasm", + "https://plugins.dprint.dev/json-0.17.2.wasm", + "https://plugins.dprint.dev/markdown-0.15.2.wasm" + ] +} diff --git a/editions/dev/tiddlers/javascript-widget-tutorial/domwidget.js b/editions/dev/tiddlers/javascript-widget-tutorial/domwidget.js index c87ae713c..49300ddbd 100644 --- a/editions/dev/tiddlers/javascript-widget-tutorial/domwidget.js +++ b/editions/dev/tiddlers/javascript-widget-tutorial/domwidget.js @@ -3,7 +3,6 @@ Library function for creating widget using a dom creating function \*/ -(function() { /*jslint node: true, browser: true */ /*global $tw: false */ diff --git a/editions/dev/tiddlers/javascript-widget-tutorial/hello-attribute-optimized.js b/editions/dev/tiddlers/javascript-widget-tutorial/hello-attribute-optimized.js index 2049f3b26..69f18ec79 100644 --- a/editions/dev/tiddlers/javascript-widget-tutorial/hello-attribute-optimized.js +++ b/editions/dev/tiddlers/javascript-widget-tutorial/hello-attribute-optimized.js @@ -3,7 +3,6 @@ Hello, World widget \*/ -(function() { /*jslint node: true, browser: true */ /*global $tw: false */ @@ -38,7 +37,7 @@ Refresh if the attribute value changed since render MyWidget.prototype.refresh = function(changedTiddlers) { // Find which attributes have changed var changedAttributes = this.computeAttributes(); - if (changedAttributes.message) { + if(changedAttributes.message) { this.refreshSelf(); return true; } else { @@ -47,4 +46,3 @@ MyWidget.prototype.refresh = function(changedTiddlers) { }; exports.hello = MyWidget; - diff --git a/editions/dev/tiddlers/javascript-widget-tutorial/hello-attribute.js b/editions/dev/tiddlers/javascript-widget-tutorial/hello-attribute.js index 195b75c94..22ba3f609 100644 --- a/editions/dev/tiddlers/javascript-widget-tutorial/hello-attribute.js +++ b/editions/dev/tiddlers/javascript-widget-tutorial/hello-attribute.js @@ -3,7 +3,6 @@ Hello, World widget \*/ -(function() { /*jslint node: true, browser: true */ /*global $tw: false */ @@ -43,4 +42,3 @@ MyWidget.prototype.refresh = function(changedTiddlers) { }; exports.hello = MyWidget; - diff --git a/editions/dev/tiddlers/javascript-widget-tutorial/refreshcount.js b/editions/dev/tiddlers/javascript-widget-tutorial/refreshcount.js index 1971c4d30..8928ef1f4 100644 --- a/editions/dev/tiddlers/javascript-widget-tutorial/refreshcount.js +++ b/editions/dev/tiddlers/javascript-widget-tutorial/refreshcount.js @@ -3,7 +3,6 @@ widget to count the number of times this widget refreshes \*/ -(function() { /*jslint node: true, browser: true */ /*global $tw: false */ @@ -39,4 +38,3 @@ MyWidget.prototype.refresh = function(changedTiddlers) { }; exports.refreshcount = MyWidget; - diff --git a/editions/dev/tiddlers/javascript-widget-tutorial/tiddlerfield-norefresh.js b/editions/dev/tiddlers/javascript-widget-tutorial/tiddlerfield-norefresh.js index 17f402221..998ee1aeb 100644 --- a/editions/dev/tiddlers/javascript-widget-tutorial/tiddlerfield-norefresh.js +++ b/editions/dev/tiddlers/javascript-widget-tutorial/tiddlerfield-norefresh.js @@ -3,7 +3,6 @@ Hello, World widget \*/ -(function() { /*jslint node: true, browser: true */ /*global $tw: false */ @@ -32,4 +31,3 @@ MyWidget.prototype.render = function(parent, nextSibling) { }; exports.tiddlerfield = MyWidget; - diff --git a/editions/dev/tiddlers/javascript-widget-tutorial/tiddlerfield.js b/editions/dev/tiddlers/javascript-widget-tutorial/tiddlerfield.js index 0caa73427..e49d2a362 100644 --- a/editions/dev/tiddlers/javascript-widget-tutorial/tiddlerfield.js +++ b/editions/dev/tiddlers/javascript-widget-tutorial/tiddlerfield.js @@ -3,7 +3,6 @@ Hello, World widget \*/ -(function() { /*jslint node: true, browser: true */ /*global $tw: false */ @@ -42,4 +41,3 @@ MyWidget.prototype.refresh = function(changedTiddlers) { }; exports.tiddlerfield = MyWidget; - diff --git a/package.json b/package.json index 28bbaea43..ede918895 100644 --- a/package.json +++ b/package.json @@ -1,37 +1,37 @@ { - "name": "tiddlywiki", - "preferGlobal": "true", - "version": "5.3.1-prerelease", - "author": "Jeremy Ruston ", - "description": "a non-linear personal web notebook", - "contributors": [ - { - "name": "Jeremy Ruston", - "email": "jeremy@jermolene.com" - } - ], - "bin": { - "tiddlywiki": "./tiddlywiki.js" - }, - "main": "./boot/boot.js", - "repository": { - "type": "git", - "url": "https://github.com/Jermolene/TiddlyWiki5.git" - }, - "keywords": [ - "tiddlywiki", - "tiddlywiki5", - "wiki" - ], - "devDependencies": { - "eslint": "^7.32.0" - }, - "bundleDependencies": [], - "license": "BSD", - "engines": { - "node": ">=0.8.2" - }, - "scripts": { - "lint": "eslint ." - } + "name": "tiddlywiki", + "preferGlobal": true, + "version": "5.3.1-prerelease", + "author": "Jeremy Ruston ", + "description": "a non-linear personal web notebook", + "contributors": [ + { + "name": "Jeremy Ruston", + "email": "jeremy@jermolene.com" + } + ], + "bin": { + "tiddlywiki": "./tiddlywiki.js" + }, + "main": "./boot/boot.js", + "repository": { + "type": "git", + "url": "https://github.com/Jermolene/TiddlyWiki5.git" + }, + "keywords": [ + "tiddlywiki", + "tiddlywiki5", + "wiki" + ], + "devDependencies": { + "dprint": "0.38.3" + }, + "bundleDependencies": [], + "license": "BSD", + "engines": { + "node": ">=0.8.2" + }, + "scripts": { + "lint": "eslint ." + } } diff --git a/plugins/tiddlywiki/browser-storage/rawmarkup.js b/plugins/tiddlywiki/browser-storage/rawmarkup.js index dd5c1cb57..de9eb355d 100644 --- a/plugins/tiddlywiki/browser-storage/rawmarkup.js +++ b/plugins/tiddlywiki/browser-storage/rawmarkup.js @@ -7,8 +7,6 @@ Startup code injected as raw markup \*/ -(function() { - // Need to initialise these because we run before bootprefix.js and boot.js $tw = window.$tw || Object.create(null); $tw.hooks = $tw.hooks || { names: {}}; @@ -30,7 +28,7 @@ function hookBootTiddlersLoaded() { // Check that browser storage is available try { window.localStorage; - } catch(e) { + } catch (e) { return; } // Step through each browsder storage item @@ -45,7 +43,7 @@ function hookBootTiddlersLoaded() { if(jsonString) { try { jsonData = JSON.parse(jsonString); - } catch(e) {} + } catch (e) {} if(jsonData) { // Convert it to a tiddler var incomingTiddler = new $tw.Tiddler(jsonData); @@ -89,4 +87,3 @@ function hookBootTiddlersLoaded() { text: $tw.utils.stringifyList(log) }); } - diff --git a/plugins/tiddlywiki/highlight-legacy/highlightblock.js b/plugins/tiddlywiki/highlight-legacy/highlightblock.js index 3cd0e4760..7309e4991 100644 --- a/plugins/tiddlywiki/highlight-legacy/highlightblock.js +++ b/plugins/tiddlywiki/highlight-legacy/highlightblock.js @@ -6,7 +6,6 @@ module-type: widget Wraps up the fenced code blocks parser for highlight and use in TiddlyWiki5 \*/ -(function() { /*jslint node: true, browser: true */ /*global $tw: false */ @@ -17,7 +16,7 @@ var CodeBlockWidget = require("$:/core/modules/widgets/codeblock.js").codeblock; var hljs = require("$:/plugins/tiddlywiki/highlight-legacy/highlight.js"); -hljs.configure({tabReplace: " "}); +hljs.configure({tabReplace: " "}); CodeBlockWidget.prototype.postRender = function() { var domNode = this.domNodes[0], @@ -29,7 +28,7 @@ CodeBlockWidget.prototype.postRender = function() { if(language && hljs.getLanguage(language)) { domNode.className = language.toLowerCase() + " hljs"; if($tw.browser && !domNode.isTiddlyWikiFakeDom) { - hljs.highlightBlock(domNode); + hljs.highlightBlock(domNode); } else { var text = domNode.textContent; domNode.children[0].innerHTML = hljs.fixMarkup(hljs.highlight(language,text).value); @@ -38,6 +37,5 @@ CodeBlockWidget.prototype.postRender = function() { domNode.children[0].textInnerHTML = text; } } - } + } }; -