diff --git a/.eslintrc.yml b/.eslintrc.yml index 8d1bbc43a..2176618fa 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -21,22 +21,10 @@ parserOptions: rules: - no-cond-assign: error - no-console: warn - no-irregular-whitespace: error - no-unreachable: error - valid-typeof: error - consistent-return: error - dot-notation: error - eqeqeq: error - no-fallthrough: error - no-unused-expressions: error - strict: off - no-catch-shadow: error - indent: - - warn - - 2 brace-style: warn + comma-dangle: + - error + - always-multiline comma-spacing: - warn - before: false @@ -44,25 +32,43 @@ rules: comma-style: - warn - last + consistent-return: error + dot-notation: error + eqeqeq: error + indent: + - warn + - 2 + jsx-quotes: + - error + - prefer-single + no-catch-shadow: error + no-cond-assign: error + no-console: warn + no-fallthrough: error + no-irregular-whitespace: error no-mixed-spaces-and-tabs: warn no-nested-ternary: warn no-trailing-spaces: warn - semi: error - padded-blocks: - - error - - classes: always - comma-dangle: - - error - - always-multiline + no-unreachable: error + no-unused-expressions: error object-curly-spacing: - error - always + padded-blocks: + - error + - classes: always + quotes: + - error + - single + semi: error + strict: off + valid-typeof: error - react/jsx-wrap-multilines: error react/jsx-no-bind: error - react/self-closing-comp: error - react/prop-types: error + react/jsx-wrap-multilines: error react/no-multi-comp: off + react/prop-types: error + react/self-closing-comp: error jsx-a11y/accessible-emoji: warn jsx-a11y/anchor-has-content: warn diff --git a/app/javascript/mastodon/components/avatar_overlay.js b/app/javascript/mastodon/components/avatar_overlay.js index e41d66ab1..c82c89637 100644 --- a/app/javascript/mastodon/components/avatar_overlay.js +++ b/app/javascript/mastodon/components/avatar_overlay.js @@ -21,8 +21,8 @@ class AvatarOverlay extends React.PureComponent { return (
-
-
+
+
); } diff --git a/app/javascript/mastodon/components/dropdown_menu.js b/app/javascript/mastodon/components/dropdown_menu.js index 4fe4db313..e637c5f79 100644 --- a/app/javascript/mastodon/components/dropdown_menu.js +++ b/app/javascript/mastodon/components/dropdown_menu.js @@ -17,7 +17,7 @@ class DropdownMenu extends React.PureComponent { }; static defaultProps = { - ariaLabel: "Menu", + ariaLabel: 'Menu', }; state = { @@ -70,7 +70,7 @@ class DropdownMenu extends React.PureComponent { render () { const { icon, items, size, direction, ariaLabel } = this.props; const { expanded } = this.state; - const directionClass = (direction === "left") ? "dropdown__left" : "dropdown__right"; + const directionClass = (direction === 'left') ? 'dropdown__left' : 'dropdown__right'; const dropdownItems = expanded && (
    diff --git a/app/javascript/mastodon/components/status_action_bar.js b/app/javascript/mastodon/components/status_action_bar.js index 064d841b8..c63457b4b 100644 --- a/app/javascript/mastodon/components/status_action_bar.js +++ b/app/javascript/mastodon/components/status_action_bar.js @@ -128,10 +128,10 @@ class StatusActionBar extends ImmutablePureComponent { } if (status.get('in_reply_to_id', null) === null) { - replyIcon = "reply"; + replyIcon = 'reply'; replyTitle = intl.formatMessage(messages.reply); } else { - replyIcon = "reply-all"; + replyIcon = 'reply-all'; replyTitle = intl.formatMessage(messages.replyAll); } @@ -142,7 +142,7 @@ class StatusActionBar extends ImmutablePureComponent {
    - +
); diff --git a/app/javascript/mastodon/containers/mastodon.js b/app/javascript/mastodon/containers/mastodon.js index 1d481d890..6d1c3f983 100644 --- a/app/javascript/mastodon/containers/mastodon.js +++ b/app/javascript/mastodon/containers/mastodon.js @@ -49,7 +49,7 @@ const { localeData, messages } = getLocale(); addLocaleData(localeData); const store = configureStore(); -const initialState = JSON.parse(document.getElementById("initial-state").textContent); +const initialState = JSON.parse(document.getElementById('initial-state').textContent); store.dispatch(hydrateStore(initialState)); const browserHistory = useRouterHistory(createBrowserHistory)({ diff --git a/app/javascript/mastodon/features/account/components/action_bar.js b/app/javascript/mastodon/features/account/components/action_bar.js index 56ebefd77..15fdd1a50 100644 --- a/app/javascript/mastodon/features/account/components/action_bar.js +++ b/app/javascript/mastodon/features/account/components/action_bar.js @@ -81,7 +81,7 @@ class ActionBar extends React.PureComponent { return (
- +
diff --git a/app/javascript/mastodon/features/compose/components/compose_form.js b/app/javascript/mastodon/features/compose/components/compose_form.js index f8a9a94ac..f413c2792 100644 --- a/app/javascript/mastodon/features/compose/components/compose_form.js +++ b/app/javascript/mastodon/features/compose/components/compose_form.js @@ -151,8 +151,8 @@ class ComposeForm extends ImmutablePureComponent { return (
-
- +
+
@@ -193,7 +193,7 @@ class ComposeForm extends ImmutablePureComponent {
-
+
diff --git a/app/javascript/mastodon/features/compose/components/emoji_picker_dropdown.js b/app/javascript/mastodon/features/compose/components/emoji_picker_dropdown.js index ffe5a1bcd..b6682f8d3 100644 --- a/app/javascript/mastodon/features/compose/components/emoji_picker_dropdown.js +++ b/app/javascript/mastodon/features/compose/components/emoji_picker_dropdown.js @@ -106,9 +106,9 @@ class EmojiPickerDropdown extends React.PureComponent { return ( - 🙂 + 🙂 { diff --git a/app/javascript/mastodon/features/compose/index.js b/app/javascript/mastodon/features/compose/index.js index 62d991ed1..e7d933e86 100644 --- a/app/javascript/mastodon/features/compose/index.js +++ b/app/javascript/mastodon/features/compose/index.js @@ -49,11 +49,11 @@ class Compose extends React.PureComponent { if (multiColumn) { header = (
- - - - - + + + + +
); } diff --git a/app/javascript/mastodon/features/getting_started/index.js b/app/javascript/mastodon/features/getting_started/index.js index b7ae7743e..e430f8b14 100644 --- a/app/javascript/mastodon/features/getting_started/index.js +++ b/app/javascript/mastodon/features/getting_started/index.js @@ -94,9 +94,9 @@ class GettingStarted extends ImmutablePureComponent { id='getting_started.support' defaultMessage='{faq} • {userguide} • {apps}' values={{ - faq: , - userguide: , - apps: , + faq: , + userguide: , + apps: , }} />

@@ -104,7 +104,7 @@ class GettingStarted extends ImmutablePureComponent { tootsuite/mastodon }} + values={{ github: tootsuite/mastodon }} />

diff --git a/app/javascript/mastodon/features/home_timeline/index.js b/app/javascript/mastodon/features/home_timeline/index.js index a8d213340..7439bf3a1 100644 --- a/app/javascript/mastodon/features/home_timeline/index.js +++ b/app/javascript/mastodon/features/home_timeline/index.js @@ -59,7 +59,7 @@ class HomeTimeline extends React.PureComponent { let emptyMessage; if (hasFollows) { - emptyMessage = ; + emptyMessage = ; } else { emptyMessage = }} />; } diff --git a/app/javascript/mastodon/features/status/components/action_bar.js b/app/javascript/mastodon/features/status/components/action_bar.js index f2ae4f259..0e0d72a2a 100644 --- a/app/javascript/mastodon/features/status/components/action_bar.js +++ b/app/javascript/mastodon/features/status/components/action_bar.js @@ -84,7 +84,7 @@ class ActionBar extends React.PureComponent {
- +
); diff --git a/app/javascript/mastodon/features/ui/index.js b/app/javascript/mastodon/features/ui/index.js index 9452e7fcf..5e70c888c 100644 --- a/app/javascript/mastodon/features/ui/index.js +++ b/app/javascript/mastodon/features/ui/index.js @@ -121,7 +121,7 @@ class UI extends React.PureComponent { {children} - +
diff --git a/app/javascript/mastodon/locales/locale-data/oc.js b/app/javascript/mastodon/locales/locale-data/oc.js index 5a85866c8..c4b56350b 100644 --- a/app/javascript/mastodon/locales/locale-data/oc.js +++ b/app/javascript/mastodon/locales/locale-data/oc.js @@ -1,5 +1,6 @@ /*eslint eqeqeq: "off"*/ /*eslint no-nested-ternary: "off"*/ +/*eslint quotes: "off"*/ export default [{ locale: "oc", diff --git a/config/webpack/development.server.js b/config/webpack/development.server.js index 4e11df4cb..8e8a399e8 100644 --- a/config/webpack/development.server.js +++ b/config/webpack/development.server.js @@ -10,7 +10,7 @@ module.exports = merge(devConfig, { devServer: { host: env.LOCAL_DOMAIN ? '0.0.0.0' : devServer.host, port: devServer.port, - headers: { "Access-Control-Allow-Origin": "*" }, + headers: { 'Access-Control-Allow-Origin': '*' }, compress: true, historyApiFallback: true, contentBase: resolve(paths.output, paths.entry), diff --git a/config/webpack/generateLocalePacks.js b/config/webpack/generateLocalePacks.js index 10a66e994..b71cf2ade 100644 --- a/config/webpack/generateLocalePacks.js +++ b/config/webpack/generateLocalePacks.js @@ -30,7 +30,7 @@ locales.forEach(locale => { // then check locales/locale-data `../../app/javascript/mastodon/locales/locale-data/${baseLocale}.js`, // fall back to English (this is what react-intl does anyway) - `../../node_modules/react-intl/locale-data/en.js`, + '../../node_modules/react-intl/locale-data/en.js', ].filter(filename => fs.existsSync(path.join(outPath, filename))) .map(filename => filename.replace(/..\/..\/node_modules\//, ''))[0]; diff --git a/config/webpack/translationRunner.js b/config/webpack/translationRunner.js index a54612549..8145c605f 100644 --- a/config/webpack/translationRunner.js +++ b/config/webpack/translationRunner.js @@ -34,11 +34,11 @@ const validateLanguages = function (languages, validators) { }, []); if (invalidLanguages.length > 0) { - console.log(`\nError: Specified invalid LANGUAGES:`); + console.log('\nError: Specified invalid LANGUAGES:'); for (let { language, error } of invalidLanguages) { console.error(`* ${language}: ${error}`); } - console.log(`\nUse yarn "manage:translations -- --help" for usage information\n`); + console.log('\nUse yarn "manage:translations -- --help" for usage information\n'); process.exit(1); } }; @@ -95,7 +95,7 @@ if (argv.help) { // check if message directory exists if (!fs.existsSync(`${process.cwd()}/${messagesDirectory}`)) { console.error(`\nError: messageDirectory not exists\n(${process.cwd()}/${messagesDirectory})\n`); - console.error(`Try to run "yarn build:development" first`); + console.error('Try to run "yarn build:development" first'); process.exit(1); } diff --git a/spec/javascript/components/features/ui/components/column.test.js b/spec/javascript/components/features/ui/components/column.test.js index df0f43e60..4491d6e19 100644 --- a/spec/javascript/components/features/ui/components/column.test.js +++ b/spec/javascript/components/features/ui/components/column.test.js @@ -13,8 +13,8 @@ describe('', () => { it('runs the scroll animation if the column contains scrollable content', () => { const wrapper = mount( - -
+ +
); wrapper.find(ColumnHeader).simulate('click'); @@ -22,7 +22,7 @@ describe('', () => { }); it('does not try to scroll if there is no scrollable content', () => { - const wrapper = mount(); + const wrapper = mount(); wrapper.find(ColumnHeader).simulate('click'); expect(global.requestAnimationFrame.called).to.equal(false); });