mirror of
https://github.com/chinchang/web-maker.git
synced 2025-05-03 00:47:56 +02:00
add eslint.
This commit is contained in:
parent
933024c709
commit
0a32371f0c
253
.eslintrc.json
Normal file
253
.eslintrc.json
Normal file
@ -0,0 +1,253 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"rules": {
|
||||
"accessor-pairs": "error",
|
||||
"array-bracket-spacing": "off",
|
||||
"array-callback-return": "error",
|
||||
"arrow-body-style": "error",
|
||||
"arrow-parens": "error",
|
||||
"arrow-spacing": "error",
|
||||
"block-scoped-var": "error",
|
||||
"block-spacing": [
|
||||
"error",
|
||||
"always"
|
||||
],
|
||||
"brace-style": "off",
|
||||
"callback-return": "error",
|
||||
"camelcase": "error",
|
||||
"comma-spacing": "off",
|
||||
"comma-style": "off",
|
||||
"complexity": "error",
|
||||
"computed-property-spacing": [
|
||||
"error",
|
||||
"never"
|
||||
],
|
||||
"consistent-return": "error",
|
||||
"consistent-this": "off",
|
||||
"curly": "error",
|
||||
"default-case": "error",
|
||||
"dot-location": [
|
||||
"error",
|
||||
"property"
|
||||
],
|
||||
"dot-notation": "error",
|
||||
"eol-last": "off",
|
||||
"eqeqeq": "error",
|
||||
"func-names": "off",
|
||||
"func-style": [
|
||||
"error",
|
||||
"declaration"
|
||||
],
|
||||
"generator-star-spacing": "error",
|
||||
"global-require": "error",
|
||||
"guard-for-in": "error",
|
||||
"handle-callback-err": "error",
|
||||
"id-blacklist": "error",
|
||||
"id-length": "off",
|
||||
"id-match": "error",
|
||||
"indent": [ "error", "tab" ],
|
||||
"init-declarations": "off",
|
||||
"jsx-quotes": "error",
|
||||
"key-spacing": [
|
||||
"error",
|
||||
{ "afterColon": true }
|
||||
],
|
||||
"keyword-spacing": [
|
||||
"error",
|
||||
{
|
||||
"after": true,
|
||||
"before": true
|
||||
}
|
||||
],
|
||||
"linebreak-style": [
|
||||
"error",
|
||||
"unix"
|
||||
],
|
||||
"lines-around-comment": "error",
|
||||
"max-depth": "error",
|
||||
"max-len": "off",
|
||||
"max-nested-callbacks": "error",
|
||||
"max-params": "error",
|
||||
"max-statements": "off",
|
||||
"max-statements-per-line": "off",
|
||||
"new-parens": "error",
|
||||
"newline-after-var": "off",
|
||||
"newline-before-return": "off",
|
||||
"newline-per-chained-call": "error",
|
||||
"no-alert": "error",
|
||||
"no-array-constructor": "error",
|
||||
"no-bitwise": "error",
|
||||
"no-caller": "error",
|
||||
"no-console": "off",
|
||||
"no-catch-shadow": "error",
|
||||
"no-confusing-arrow": "error",
|
||||
"no-continue": "error",
|
||||
"no-div-regex": "error",
|
||||
"no-duplicate-imports": "error",
|
||||
"no-else-return": "error",
|
||||
"no-empty-function": "off",
|
||||
"no-eq-null": "error",
|
||||
"no-eval": "error",
|
||||
"no-extend-native": "error",
|
||||
"no-extra-bind": "error",
|
||||
"no-extra-label": "error",
|
||||
"no-extra-parens": "off",
|
||||
"no-floating-decimal": "error",
|
||||
"no-implicit-coercion": "error",
|
||||
"no-implicit-globals": "off",
|
||||
"no-implied-eval": "error",
|
||||
"no-inline-comments": "error",
|
||||
"no-inner-declarations": [
|
||||
"error",
|
||||
"functions"
|
||||
],
|
||||
"no-invalid-this": "error",
|
||||
"no-iterator": "error",
|
||||
"no-label-var": "error",
|
||||
"no-labels": "error",
|
||||
"no-lone-blocks": "error",
|
||||
"no-lonely-if": "error",
|
||||
"no-loop-func": "error",
|
||||
"no-magic-numbers": "off",
|
||||
"no-mixed-requires": "error",
|
||||
"no-multi-spaces": "error",
|
||||
"no-multi-str": "error",
|
||||
"no-multiple-empty-lines": "error",
|
||||
"no-native-reassign": "error",
|
||||
"no-negated-condition": "off",
|
||||
"no-nested-ternary": "error",
|
||||
"no-new": "error",
|
||||
"no-new-func": "error",
|
||||
"no-new-object": "error",
|
||||
"no-new-require": "error",
|
||||
"no-new-wrappers": "error",
|
||||
"no-octal-escape": "error",
|
||||
"no-param-reassign": [
|
||||
"error",
|
||||
{
|
||||
"props": false
|
||||
}
|
||||
],
|
||||
"no-path-concat": "error",
|
||||
"no-plusplus": [
|
||||
"error",
|
||||
{
|
||||
"allowForLoopAfterthoughts": true
|
||||
}
|
||||
],
|
||||
"no-process-env": "error",
|
||||
"no-process-exit": "error",
|
||||
"no-proto": "error",
|
||||
"no-prototype-builtins": "error",
|
||||
"no-restricted-globals": "error",
|
||||
"no-restricted-imports": "error",
|
||||
"no-restricted-modules": "error",
|
||||
"no-restricted-syntax": "error",
|
||||
"no-return-assign": "error",
|
||||
"no-script-url": "error",
|
||||
"no-self-compare": "error",
|
||||
"no-sequences": "error",
|
||||
"no-shadow": "error",
|
||||
"no-shadow-restricted-names": "error",
|
||||
"no-spaced-func": "error",
|
||||
"no-sync": "error",
|
||||
"no-ternary": "off",
|
||||
"no-throw-literal": "error",
|
||||
"no-trailing-spaces": "error",
|
||||
"no-undef-init": "error",
|
||||
"no-undefined": "error",
|
||||
"no-underscore-dangle": "error",
|
||||
"no-unmodified-loop-condition": "error",
|
||||
"no-unneeded-ternary": "error",
|
||||
"no-unsafe-finally": "error",
|
||||
"no-unused-expressions": "error",
|
||||
"no-use-before-define": "error",
|
||||
"no-useless-call": "error",
|
||||
"no-useless-computed-key": "error",
|
||||
"no-useless-concat": "off",
|
||||
"no-useless-constructor": "error",
|
||||
"no-useless-escape": "error",
|
||||
"no-useless-rename": "error",
|
||||
"no-var": "off",
|
||||
"no-void": "error",
|
||||
"no-warning-comments": "error",
|
||||
"no-whitespace-before-property": "error",
|
||||
"no-with": "error",
|
||||
"object-curly-spacing": [
|
||||
"error",
|
||||
"never"
|
||||
],
|
||||
"object-property-newline": "error",
|
||||
"object-shorthand": "off",
|
||||
"one-var": "off",
|
||||
"one-var-declaration-per-line": "error",
|
||||
"operator-assignment": [
|
||||
"error",
|
||||
"always"
|
||||
],
|
||||
"operator-linebreak": [
|
||||
"error",
|
||||
"before"
|
||||
],
|
||||
"padded-blocks": "off",
|
||||
"prefer-arrow-callback": "off",
|
||||
"prefer-const": "error",
|
||||
"prefer-reflect": "error",
|
||||
"prefer-rest-params": "off",
|
||||
"prefer-spread": "error",
|
||||
"prefer-template": "off",
|
||||
"quote-props": "off",
|
||||
"quotes": "off",
|
||||
"radix": "error",
|
||||
"require-jsdoc": "off",
|
||||
"require-yield": "error",
|
||||
"semi": "off",
|
||||
"semi-spacing": [
|
||||
"error",
|
||||
{
|
||||
"after": true,
|
||||
"before": false
|
||||
}
|
||||
],
|
||||
"sort-imports": "error",
|
||||
"sort-vars": "off",
|
||||
"space-before-blocks": "off",
|
||||
"space-before-function-paren": "off",
|
||||
"space-in-parens": [
|
||||
"error",
|
||||
"never"
|
||||
],
|
||||
"space-infix-ops": "error",
|
||||
"space-unary-ops": "error",
|
||||
"spaced-comment": [
|
||||
"error",
|
||||
"always"
|
||||
],
|
||||
"strict": [
|
||||
"error",
|
||||
"never"
|
||||
],
|
||||
"template-curly-spacing": "error",
|
||||
"unicode-bom": [
|
||||
"error",
|
||||
"never"
|
||||
],
|
||||
"valid-jsdoc": "error",
|
||||
"vars-on-top": "off",
|
||||
"wrap-regex": "error",
|
||||
"yield-star-spacing": "error",
|
||||
"yoda": [
|
||||
"error",
|
||||
"never"
|
||||
]
|
||||
},
|
||||
"globals": {
|
||||
"chrome": true,
|
||||
"CodeMirror": true,
|
||||
"Split": true,
|
||||
"emmetCodeMirror": true
|
||||
}
|
||||
}
|
@ -1,3 +1,6 @@
|
||||
chrome.browserAction.onClicked.addListener(function(activeTab) {
|
||||
chrome.tabs.create({ url: chrome.extension.getURL('index.html'), selected: true });
|
||||
chrome.browserAction.onClicked.addListener(function(){
|
||||
chrome.tabs.create({
|
||||
url: chrome.extension.getURL('index.html'),
|
||||
selected: true
|
||||
});
|
||||
});
|
@ -1,6 +1,8 @@
|
||||
/* eslint-disable no-extra-semi */
|
||||
;(function () {
|
||||
|
||||
editur = window.editur || {};
|
||||
/* eslint-enable no-extra-semi */
|
||||
var editur = window.editur || {};
|
||||
|
||||
var $ = document.querySelector.bind(document);
|
||||
var $all = document.querySelectorAll.bind(document);
|
||||
@ -10,7 +12,7 @@
|
||||
, currentLayoutMode
|
||||
, frame = $('#demo-frame')
|
||||
, htmlCode = $('#js-html-code')
|
||||
,cssCode = $('#js-css-code')
|
||||
, cssCode = $('#js-css-code')
|
||||
, jsCode = $('#js-js-code')
|
||||
, layoutBtn1 = $('#js-layout-btn-1')
|
||||
, layoutBtn2 = $('#js-layout-btn-2')
|
||||
@ -44,7 +46,7 @@
|
||||
direction: (currentLayoutMode === 2 ? 'vertical' : 'horizontal')
|
||||
});
|
||||
}
|
||||
window.toggleLayout = function (mode) {
|
||||
function toggleLayout(mode) {
|
||||
currentLayoutMode = mode;
|
||||
$('#js-layout-btn-1').classList.remove('selected');
|
||||
$('#js-layout-btn-2').classList.remove('selected');
|
||||
@ -58,12 +60,12 @@
|
||||
resetSplitting();
|
||||
}
|
||||
|
||||
window.saveSetting = function saveSetting(setting, value) {
|
||||
function saveSetting(setting, value) {
|
||||
var obj = {};
|
||||
obj[setting] = value;
|
||||
chrome.storage.local.set(obj, function() {
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function saveCode() {
|
||||
var code = {
|
||||
@ -79,7 +81,6 @@
|
||||
};
|
||||
|
||||
editur.setPreviewContent = function () {
|
||||
var self = this;
|
||||
var html = editur.cm.html.getValue();
|
||||
var css = editur.cm.css.getValue();
|
||||
var js = editur.cm.js.getValue();
|
||||
@ -89,7 +90,7 @@
|
||||
|
||||
var fileWritten = false;
|
||||
|
||||
var blob = new Blob([ html ], {type : "text/plain;charset=UTF-8"});
|
||||
var blob = new Blob([ html ], {type: "text/plain;charset=UTF-8"});
|
||||
|
||||
function errorHandler() { console.log(arguments); }
|
||||
|
||||
@ -120,7 +121,7 @@
|
||||
lineWrapping: true,
|
||||
autofocus: options.autofocus || false,
|
||||
autoCloseBrackets: true,
|
||||
matchBrackets: true,
|
||||
matchBrackets: true,
|
||||
tabMode: 'indent',
|
||||
keyMap: 'sublime',
|
||||
theme: 'monokai',
|
||||
@ -176,7 +177,7 @@
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
saveHtmlBtn.addEventListener('click', function (e) {
|
||||
saveHtmlBtn.addEventListener('click', function () {
|
||||
var html = editur.cm.html.getValue();
|
||||
var css = editur.cm.css.getValue();
|
||||
var js = editur.cm.js.getValue();
|
||||
@ -190,7 +191,7 @@
|
||||
fileName += '.html';
|
||||
|
||||
var a = document.createElement('a');
|
||||
var blob = new Blob([ fileContent ], {type : "text/html;charset=UTF-8"});
|
||||
var blob = new Blob([ fileContent ], {type: "text/html;charset=UTF-8"});
|
||||
a.href = window.URL.createObjectURL(blob);
|
||||
a.download = fileName;
|
||||
a.style.display = 'none';
|
||||
@ -205,7 +206,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
settingsBtn.addEventListener('click', function(e) {
|
||||
settingsBtn.addEventListener('click', function() {
|
||||
if (!chrome.runtime.openOptionsPage) {
|
||||
// New way to open options pages, if supported (Chrome 42+).
|
||||
// Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=601997
|
||||
|
Loading…
x
Reference in New Issue
Block a user