mirror of
https://github.com/discourse/discourse-signatures.git
synced 2025-12-13 02:13:32 +00:00
DEV: apply coding standards (#6)
This commit is contained in:
parent
edee23c5a7
commit
a3433abfef
104
.eslintrc
104
.eslintrc
@ -1,105 +1,3 @@
|
|||||||
{
|
{
|
||||||
"env": {
|
"extends": "eslint-config-discourse"
|
||||||
"jasmine": true,
|
|
||||||
"node": true,
|
|
||||||
"mocha": true,
|
|
||||||
"browser": true,
|
|
||||||
"builtin": true
|
|
||||||
},
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": 7,
|
|
||||||
"sourceType": "module"
|
|
||||||
},
|
|
||||||
"globals":
|
|
||||||
{"Ember":true,
|
|
||||||
"jQuery":true,
|
|
||||||
"$":true,
|
|
||||||
"RSVP":true,
|
|
||||||
"Discourse":true,
|
|
||||||
"Em":true,
|
|
||||||
"PreloadStore":true,
|
|
||||||
"Handlebars":true,
|
|
||||||
"I18n":true,
|
|
||||||
"bootbox":true,
|
|
||||||
"module":true,
|
|
||||||
"moduleFor":true,
|
|
||||||
"moduleForComponent":true,
|
|
||||||
"Pretender":true,
|
|
||||||
"sandbox":true,
|
|
||||||
"controllerFor":true,
|
|
||||||
"test":true,
|
|
||||||
"ok":true,
|
|
||||||
"not":true,
|
|
||||||
"expect":true,
|
|
||||||
"equal":true,
|
|
||||||
"visit":true,
|
|
||||||
"andThen":true,
|
|
||||||
"click":true,
|
|
||||||
"currentPath":true,
|
|
||||||
"currentRouteName":true,
|
|
||||||
"currentURL":true,
|
|
||||||
"fillIn":true,
|
|
||||||
"keyEvent":true,
|
|
||||||
"triggerEvent":true,
|
|
||||||
"count":true,
|
|
||||||
"exists":true,
|
|
||||||
"visible":true,
|
|
||||||
"invisible":true,
|
|
||||||
"asyncRender":true,
|
|
||||||
"selectDropdown":true,
|
|
||||||
"asyncTestDiscourse":true,
|
|
||||||
"fixture":true,
|
|
||||||
"find":true,
|
|
||||||
"sinon":true,
|
|
||||||
"moment":true,
|
|
||||||
"start":true,
|
|
||||||
"_":true,
|
|
||||||
"alert":true,
|
|
||||||
"containsInstance":true,
|
|
||||||
"deepEqual":true,
|
|
||||||
"notEqual":true,
|
|
||||||
"define":true,
|
|
||||||
"require":true,
|
|
||||||
"requirejs":true,
|
|
||||||
"hasModule":true,
|
|
||||||
"Blob":true,
|
|
||||||
"File":true},
|
|
||||||
"rules": {
|
|
||||||
"block-scoped-var": 2,
|
|
||||||
"dot-notation": 0,
|
|
||||||
"eqeqeq": [
|
|
||||||
2,
|
|
||||||
"allow-null"
|
|
||||||
],
|
|
||||||
"guard-for-in": 2,
|
|
||||||
"no-bitwise": 2,
|
|
||||||
"no-caller": 2,
|
|
||||||
"no-cond-assign": 0,
|
|
||||||
"no-debugger": 2,
|
|
||||||
"no-empty": 0,
|
|
||||||
"no-eval": 2,
|
|
||||||
"no-extend-native": 2,
|
|
||||||
"no-extra-parens": 0,
|
|
||||||
"no-irregular-whitespace": 2,
|
|
||||||
"no-iterator": 2,
|
|
||||||
"no-loop-func": 2,
|
|
||||||
"no-multi-str": 2,
|
|
||||||
"no-new": 2,
|
|
||||||
"no-plusplus": 0,
|
|
||||||
"no-proto": 2,
|
|
||||||
"no-script-url": 2,
|
|
||||||
"no-sequences": 2,
|
|
||||||
"no-shadow": 2,
|
|
||||||
"no-undef": 2,
|
|
||||||
"no-unused-vars": 2,
|
|
||||||
"no-with": 2,
|
|
||||||
"semi": 2,
|
|
||||||
"strict": 0,
|
|
||||||
"valid-typeof": 2,
|
|
||||||
"wrap-iife": [
|
|
||||||
2,
|
|
||||||
"inside"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"parser": "babel-eslint"
|
|
||||||
}
|
}
|
||||||
|
|||||||
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1,5 @@
|
|||||||
.idea/*
|
.idea/*
|
||||||
*.iml
|
*.iml
|
||||||
|
node_modules
|
||||||
|
yarn-error.log
|
||||||
|
.rubocop-https---raw-githubusercontent-com-discourse-*
|
||||||
|
|||||||
4
.template-lintrc.js
Normal file
4
.template-lintrc.js
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
module.exports = {
|
||||||
|
plugins: ["ember-template-lint-plugin-discourse"],
|
||||||
|
extends: "discourse:recommended",
|
||||||
|
};
|
||||||
@ -4,7 +4,7 @@ import RawHtml from "discourse/widgets/raw-html";
|
|||||||
function attachSignature(api, siteSettings) {
|
function attachSignature(api, siteSettings) {
|
||||||
api.includePostAttributes("user_signature");
|
api.includePostAttributes("user_signature");
|
||||||
|
|
||||||
api.decorateWidget("post-contents:after-cooked", dec => {
|
api.decorateWidget("post-contents:after-cooked", (dec) => {
|
||||||
const attrs = dec.attrs;
|
const attrs = dec.attrs;
|
||||||
if (Ember.isEmpty(attrs.user_signature)) {
|
if (Ember.isEmpty(attrs.user_signature)) {
|
||||||
return;
|
return;
|
||||||
@ -20,16 +20,16 @@ function attachSignature(api, siteSettings) {
|
|||||||
dec.h(
|
dec.h(
|
||||||
"div",
|
"div",
|
||||||
new RawHtml({
|
new RawHtml({
|
||||||
html: `<div class='user-signature'>${attrs.user_signature}</div>`
|
html: `<div class='user-signature'>${attrs.user_signature}</div>`,
|
||||||
})
|
})
|
||||||
)
|
),
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
return [
|
return [
|
||||||
dec.h("hr"),
|
dec.h("hr"),
|
||||||
dec.h("img.signature-img", {
|
dec.h("img.signature-img", {
|
||||||
attributes: { src: attrs.user_signature }
|
attributes: { src: attrs.user_signature },
|
||||||
})
|
}),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -42,7 +42,7 @@ export default {
|
|||||||
initialize(container) {
|
initialize(container) {
|
||||||
const siteSettings = container.lookup("site-settings:main");
|
const siteSettings = container.lookup("site-settings:main");
|
||||||
if (siteSettings.signatures_enabled) {
|
if (siteSettings.signatures_enabled) {
|
||||||
withPluginApi("0.1", api => attachSignature(api, siteSettings));
|
withPluginApi("0.1", (api) => attachSignature(api, siteSettings));
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
7
package.json
Normal file
7
package.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"author": "Discourse",
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint-config-discourse": "latest"
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user