logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe
commit: bf0ee1a25c10105e096d677782d9c0ae3e36f5a5
parent: fa0be3f834b54bb276eb5233195181fa3760710f
Author: Yamagishi Kazutoshi <ykzts@desire.sh>
Date:   Mon, 16 Oct 2017 18:12:09 +0900

Enable ESLint rules import/* (#5414)

* Enable ESLint rules import/*

* fix

Diffstat:

M.eslintrc.yml23++++++++++++++++++++++-
Mapp/javascript/mastodon/base_polyfills.js2+-
Mapp/javascript/mastodon/containers/mastodon.js1+
Dapp/javascript/mastodon/features/compose/containers/autosuggest_status_container.js15---------------
Mapp/javascript/mastodon/features/emoji/emoji_compressed.js3++-
Mapp/javascript/mastodon/main.js2+-
Mapp/javascript/packs/common.js2+-
Mpackage.json2++
Myarn.lock53+++++++++++++++++++++++++++++++++++++++++++++++++++--
9 files changed, 81 insertions(+), 22 deletions(-)

diff --git a/.eslintrc.yml b/.eslintrc.yml @@ -12,6 +12,7 @@ parser: babel-eslint plugins: - react - jsx-a11y +- import parserOptions: sourceType: module @@ -22,8 +23,14 @@ parserOptions: modules: true spread: true -rules: +settings: + import/extensions: + - .js + import/ignore: + - node_modules + - \\.(css|scss|json)$ +rules: brace-style: warn comma-dangle: - error @@ -126,3 +133,17 @@ rules: jsx-a11y/role-supports-aria-props: off jsx-a11y/scope: warn jsx-a11y/tabindex-no-positive: warn + + import/extensions: + - error + - always + - js: never + import/newline-after-import: error + import/no-extraneous-dependencies: + - error + - devDependencies: + - "config/webpack/**" + - "app/javascript/mastodon/test_setup.js" + - "app/javascript/**/__tests__/**" + import/no-unresolved: error + import/no-webpack-loader-syntax: error diff --git a/app/javascript/mastodon/base_polyfills.js b/app/javascript/mastodon/base_polyfills.js @@ -1,5 +1,5 @@ import 'intl'; -import 'intl/locale-data/jsonp/en.js'; +import 'intl/locale-data/jsonp/en'; import 'es6-symbol/implement'; import includes from 'array-includes'; import assign from 'object-assign'; diff --git a/app/javascript/mastodon/containers/mastodon.js b/app/javascript/mastodon/containers/mastodon.js @@ -10,6 +10,7 @@ import { hydrateStore } from '../actions/store'; import { connectUserStream } from '../actions/streaming'; import { IntlProvider, addLocaleData } from 'react-intl'; import { getLocale } from '../locales'; + const { localeData, messages } = getLocale(); addLocaleData(localeData); diff --git a/app/javascript/mastodon/features/compose/containers/autosuggest_status_container.js b/app/javascript/mastodon/features/compose/containers/autosuggest_status_container.js @@ -1,15 +0,0 @@ -import { connect } from 'react-redux'; -import AutosuggestStatus from '../components/autosuggest_status'; -import { makeGetStatus } from '../../../selectors'; - -const makeMapStateToProps = () => { - const getStatus = makeGetStatus(); - - const mapStateToProps = (state, { id }) => ({ - status: getStatus(state, id), - }); - - return mapStateToProps; -}; - -export default connect(makeMapStateToProps)(AutosuggestStatus); diff --git a/app/javascript/mastodon/features/emoji/emoji_compressed.js b/app/javascript/mastodon/features/emoji/emoji_compressed.js @@ -9,7 +9,8 @@ const { unicodeToFilename } = require('./unicode_to_filename'); const { unicodeToUnifiedName } = require('./unicode_to_unified_name'); const emojiMap = require('./emoji_map.json'); const { emojiIndex } = require('emoji-mart'); -const emojiMartData = require('emoji-mart/dist/data').default; +const { default: emojiMartData } = require('emoji-mart/dist/data'); + const excluded = ['®', '©', '™']; const skins = ['🏻', '🏼', '🏽', '🏾', '🏿']; const shortcodeMap = {}; diff --git a/app/javascript/mastodon/main.js b/app/javascript/mastodon/main.js @@ -1,5 +1,5 @@ import * as WebPushSubscription from './web_push_subscription'; -import Mastodon from 'mastodon/containers/mastodon'; +import Mastodon from './containers/mastodon'; import React from 'react'; import ReactDOM from 'react-dom'; import ready from './ready'; diff --git a/app/javascript/packs/common.js b/app/javascript/packs/common.js @@ -1,6 +1,6 @@ import { start } from 'rails-ujs'; +import 'font-awesome/css/font-awesome.css'; -require('font-awesome/css/font-awesome.css'); require.context('../images/', true); start(); diff --git a/package.json b/package.json @@ -57,6 +57,7 @@ "immutable": "^3.8.1", "intersection-observer": "^0.4.0", "intl": "^1.2.5", + "intl-messageformat": "^2.1.0", "intl-relativeformat": "^2.0.0", "is-nan": "^1.2.1", "js-yaml": "^3.9.0", @@ -121,6 +122,7 @@ "enzyme": "^3.0.0", "enzyme-adapter-react-16": "^1.0.0", "eslint": "^3.19.0", + "eslint-plugin-import": "^2.7.0", "eslint-plugin-jsx-a11y": "^4.0.0", "eslint-plugin-react": "^6.10.3", "jest": "^21.2.1", diff --git a/yarn.lock b/yarn.lock @@ -1285,7 +1285,7 @@ buffer@^4.3.0: ieee754 "^1.1.4" isarray "^1.0.0" -builtin-modules@^1.0.0: +builtin-modules@^1.0.0, builtin-modules@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" @@ -1623,6 +1623,10 @@ constants-browserify@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" +contains-path@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" + content-disposition@0.5.2: version "0.5.2" resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.2.tgz#0cf68bb9ddf5f2be7961c3a85178cb85dba78cb4" @@ -2106,7 +2110,7 @@ dns-txt@^2.0.2: dependencies: buffer-indexof "^1.0.0" -doctrine@^1.2.2: +doctrine@1.5.0, doctrine@^1.2.2: version "1.5.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" dependencies: @@ -2396,6 +2400,35 @@ escope@^3.6.0: esrecurse "^4.1.0" estraverse "^4.1.1" +eslint-import-resolver-node@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.1.tgz#4422574cde66a9a7b099938ee4d508a199e0e3cc" + dependencies: + debug "^2.6.8" + resolve "^1.2.0" + +eslint-module-utils@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.1.1.tgz#abaec824177613b8a95b299639e1b6facf473449" + dependencies: + debug "^2.6.8" + pkg-dir "^1.0.0" + +eslint-plugin-import@^2.7.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.7.0.tgz#21de33380b9efb55f5ef6d2e210ec0e07e7fa69f" + dependencies: + builtin-modules "^1.1.1" + contains-path "^0.1.0" + debug "^2.6.8" + doctrine "1.5.0" + eslint-import-resolver-node "^0.3.1" + eslint-module-utils "^2.1.1" + has "^1.0.1" + lodash.cond "^4.3.0" + minimatch "^3.0.3" + read-pkg-up "^2.0.0" + eslint-plugin-jsx-a11y@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-4.0.0.tgz#779bb0fe7b08da564a422624911de10061e048ee" @@ -4240,6 +4273,10 @@ lodash.clonedeep@^4.3.2: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" +lodash.cond@^4.3.0: + version "4.5.2" + resolved "https://registry.yarnpkg.com/lodash.cond/-/lodash.cond-4.5.2.tgz#f471a1da486be60f6ab955d17115523dd1d255d5" + lodash.defaults@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-3.1.2.tgz#c7308b18dbf8bc9372d701a73493c61192bd2e2c" @@ -5142,6 +5179,12 @@ pinkie@^2.0.0: version "2.0.4" resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" +pkg-dir@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-1.0.0.tgz#7a4b508a8d5bb2d629d447056ff4e9c9314cf3d4" + dependencies: + find-up "^1.0.0" + pkg-dir@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-2.0.0.tgz#f6d5d1109e19d63edf428e0bd57e12777615334b" @@ -6355,6 +6398,12 @@ resolve@^1.1.6, resolve@^1.1.7, resolve@^1.3.3: dependencies: path-parse "^1.0.5" +resolve@^1.2.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.4.0.tgz#a75be01c53da25d934a98ebd0e4c4a7312f92a86" + dependencies: + path-parse "^1.0.5" + restore-cursor@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541"