mirror of
https://github.com/strapi/strapi.git
synced 2025-12-25 06:04:29 +00:00
Use eslint import-order and import-imports-first
This commit is contained in:
parent
5621a5bcca
commit
ec8288350f
@ -5,10 +5,15 @@
|
||||
* only setup and plugin code.
|
||||
*/
|
||||
|
||||
import { syncHistoryWithStore } from 'react-router-redux';
|
||||
import configureStore from './store';
|
||||
import React from 'react';
|
||||
import { Provider } from 'react-redux';
|
||||
import { syncHistoryWithStore } from 'react-router-redux';
|
||||
|
||||
import App from './containers/App';
|
||||
import createRoutes from './routes';
|
||||
import configureStore from './store';
|
||||
import { selectLocationState } from './containers/App/selectors';
|
||||
import { translationMessages } from './i18n';
|
||||
|
||||
// Create redux store with history
|
||||
// this uses the singleton browserHistory provided by react-router
|
||||
@ -19,16 +24,10 @@ const store = configureStore({}, window.Strapi.router);
|
||||
// Sync history and store, as the react-router-redux reducer
|
||||
// is under the non-default key ("routing"), selectLocationState
|
||||
// must be provided for resolving how to retrieve the "route" in the state
|
||||
import { selectLocationState } from 'containers/App/selectors';
|
||||
syncHistoryWithStore(window.Strapi.router, store, {
|
||||
selectLocationState: selectLocationState(),
|
||||
});
|
||||
|
||||
// Set up the router, wrapping all Routes in the App component
|
||||
import App from 'containers/App';
|
||||
import createRoutes from './routes';
|
||||
import { translationMessages } from './i18n';
|
||||
|
||||
// Plugin identifier based on the package.json `name` value
|
||||
const pluginId = require('../package.json').name.replace(
|
||||
/^strapi-plugin-/i,
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import styles from './styles.scss';
|
||||
|
||||
class Container extends React.Component {
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import TableHeader from 'components/TableHeader';
|
||||
import TableRow from 'components/TableRow';
|
||||
import TableHeader from '../TableHeader';
|
||||
import TableRow from '../TableRow';
|
||||
|
||||
import styles from './styles.scss';
|
||||
|
||||
|
||||
@ -5,8 +5,9 @@
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import Pagination from 'components/Pagination';
|
||||
import LimitSelect from 'components/LimitSelect';
|
||||
|
||||
import LimitSelect from '../LimitSelect';
|
||||
import Pagination from '../Pagination';
|
||||
|
||||
import styles from './styles.scss';
|
||||
|
||||
|
||||
@ -6,12 +6,11 @@
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
|
||||
import { loadModels } from './actions';
|
||||
import { makeSelectModels, makeSelectLoading } from './selectors';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import '../../styles/main.scss';
|
||||
|
||||
class App extends React.Component {
|
||||
componentWillMount() {
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
import { fromJS } from 'immutable';
|
||||
|
||||
import { LOAD_MODELS, LOADED_MODELS } from './constants';
|
||||
|
||||
const initialState = fromJS({
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
import _ from 'lodash';
|
||||
import { takeLatest } from 'redux-saga';
|
||||
import { fork, put } from 'redux-saga/effects';
|
||||
import _ from 'lodash';
|
||||
|
||||
import { loadedModels } from './actions';
|
||||
|
||||
import { LOAD_MODELS } from './constants';
|
||||
|
||||
export function* getModels() {
|
||||
|
||||
@ -5,12 +5,13 @@
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import _ from 'lodash';
|
||||
import { connect } from 'react-redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
import _ from 'lodash';
|
||||
|
||||
import Container from 'components/Container';
|
||||
import EditForm from 'components/EditForm';
|
||||
import Container from '../../components/Container';
|
||||
import EditForm from '../../components/EditForm';
|
||||
import { makeSelectModels } from '../App/selectors';
|
||||
|
||||
import {
|
||||
setCurrentModelName,
|
||||
@ -20,7 +21,6 @@ import {
|
||||
editRecord,
|
||||
deleteRecord,
|
||||
} from './actions';
|
||||
|
||||
import {
|
||||
makeSelectRecord,
|
||||
makeSelectLoading,
|
||||
@ -30,8 +30,6 @@ import {
|
||||
makeSelectIsCreating,
|
||||
} from './selectors';
|
||||
|
||||
import { makeSelectModels } from 'containers/App/selectors';
|
||||
|
||||
export class Edit extends React.Component {
|
||||
componentWillMount() {
|
||||
this.props.setCurrentModelName(this.props.routeParams.slug.toLowerCase());
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
import { fromJS } from 'immutable';
|
||||
|
||||
import {
|
||||
SET_CURRENT_MODEL_NAME,
|
||||
SET_IS_CREATING,
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
import { takeLatest } from 'redux-saga';
|
||||
import { put, select, fork, call, cancel, take } from 'redux-saga/effects';
|
||||
import request from 'utils/request';
|
||||
import { router } from 'app';
|
||||
import { call, cancel, fork, put, take, select } from 'redux-saga/effects';
|
||||
import { LOCATION_CHANGE } from 'react-router-redux';
|
||||
|
||||
import request from '../../utils/request';
|
||||
import { router } from '../../app';
|
||||
|
||||
import {
|
||||
recordLoaded,
|
||||
recordEdited,
|
||||
@ -11,9 +12,7 @@ import {
|
||||
recordDeleted,
|
||||
recordDeleteError,
|
||||
} from './actions';
|
||||
|
||||
import { LOAD_RECORD, EDIT_RECORD, DELETE_RECORD } from './constants';
|
||||
|
||||
import {
|
||||
makeSelectCurrentModelName,
|
||||
makeSelectRecord,
|
||||
|
||||
@ -5,10 +5,12 @@
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
import Container from 'components/Container';
|
||||
import { injectIntl } from 'react-intl';
|
||||
|
||||
import Container from '../../components/Container';
|
||||
|
||||
import styles from './styles.scss';
|
||||
|
||||
export class HomePage extends React.Component {
|
||||
render() {
|
||||
const PluginHeader = this.props.exposedComponents.PluginHeader;
|
||||
|
||||
@ -10,12 +10,12 @@ import { createStructuredSelector } from 'reselect';
|
||||
import { injectIntl } from 'react-intl';
|
||||
import _ from 'lodash';
|
||||
|
||||
import Container from 'components/Container';
|
||||
import Table from 'components/Table';
|
||||
import TableFooter from 'components/TableFooter';
|
||||
import { makeSelectModels } from '../App/selectors';
|
||||
import Container from '../../components/Container';
|
||||
import Table from '../../components/Table';
|
||||
import TableFooter from '../../components/TableFooter';
|
||||
|
||||
import styles from './styles.scss';
|
||||
|
||||
import {
|
||||
setCurrentModelName,
|
||||
loadRecords,
|
||||
@ -24,7 +24,6 @@ import {
|
||||
changeSort,
|
||||
changeLimit,
|
||||
} from './actions';
|
||||
|
||||
import {
|
||||
makeSelectRecords,
|
||||
makeSelectLoadingRecords,
|
||||
@ -37,8 +36,6 @@ import {
|
||||
makeSelectLoadingCount,
|
||||
} from './selectors';
|
||||
|
||||
import { makeSelectModels } from 'containers/App/selectors';
|
||||
|
||||
export class List extends React.Component {
|
||||
componentWillMount() {
|
||||
// Init the view
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
import { fromJS } from 'immutable';
|
||||
|
||||
import {
|
||||
SET_CURRENT_MODEL_NAME,
|
||||
LOAD_RECORDS,
|
||||
@ -15,7 +16,6 @@ import {
|
||||
CHANGE_SORT,
|
||||
CHANGE_LIMIT,
|
||||
} from './constants';
|
||||
|
||||
const initialState = fromJS({
|
||||
currentModel: false,
|
||||
currentModelNamePluralized: false,
|
||||
|
||||
@ -1,12 +1,11 @@
|
||||
import { takeLatest } from 'redux-saga';
|
||||
import { put, select, fork, call, take, cancel } from 'redux-saga/effects';
|
||||
import request from 'utils/request';
|
||||
import { LOCATION_CHANGE } from 'react-router-redux';
|
||||
|
||||
import request from '../../utils/request';
|
||||
|
||||
import { loadedRecord, loadedCount } from './actions';
|
||||
|
||||
import { LOAD_RECORDS, LOAD_COUNT } from './constants';
|
||||
|
||||
import {
|
||||
makeSelectCurrentModelName,
|
||||
makeSelectLimit,
|
||||
|
||||
@ -7,7 +7,7 @@ import { combineReducers } from 'redux-immutable';
|
||||
import { fromJS } from 'immutable';
|
||||
import { LOCATION_CHANGE } from 'react-router-redux';
|
||||
|
||||
import globalReducer from 'containers/App/reducer';
|
||||
import globalReducer from './containers/App/reducer';
|
||||
|
||||
/*
|
||||
* routeReducer
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
// They are all wrapped in the App component, which should contain the navbar etc
|
||||
// See http://blog.mxstbr.com/2016/01/react-apps-with-pages for more information
|
||||
// about the code splitting business
|
||||
import { getAsyncInjectors } from 'utils/asyncInjectors';
|
||||
import appSagas from 'containers/App/sagas';
|
||||
import { getAsyncInjectors } from './utils/asyncInjectors';
|
||||
import appSagas from './containers/App/sagas';
|
||||
|
||||
const loadModule = cb => componentModule => {
|
||||
cb(null, componentModule.default);
|
||||
@ -21,8 +21,8 @@ export default function createRoutes(store) {
|
||||
path: '',
|
||||
name: 'home',
|
||||
getComponent(nextState, cb) {
|
||||
const reducer = require('containers/HomePage/reducer'); // eslint-disable-line global-require
|
||||
const component = require('containers/HomePage'); // eslint-disable-line global-require
|
||||
const reducer = require('./containers/HomePage/reducer'); // eslint-disable-line global-require
|
||||
const component = require('./containers/HomePage'); // eslint-disable-line global-require
|
||||
|
||||
const renderRoute = loadModule(cb);
|
||||
|
||||
@ -36,9 +36,9 @@ export default function createRoutes(store) {
|
||||
path: '/:slug',
|
||||
name: 'list',
|
||||
getComponent(nextState, cb) {
|
||||
const reducer = require('containers/List/reducer'); // eslint-disable-line global-require
|
||||
const sagas = require('containers/List/sagas'); // eslint-disable-line global-require
|
||||
const component = require('containers/List'); // eslint-disable-line global-require
|
||||
const reducer = require('./containers/List/reducer'); // eslint-disable-line global-require
|
||||
const sagas = require('./containers/List/sagas'); // eslint-disable-line global-require
|
||||
const component = require('./containers/List'); // eslint-disable-line global-require
|
||||
|
||||
const renderRoute = loadModule(cb);
|
||||
|
||||
@ -53,9 +53,9 @@ export default function createRoutes(store) {
|
||||
path: '/:slug/:id',
|
||||
name: 'list',
|
||||
getComponent(nextState, cb) {
|
||||
const reducer = require('containers/Edit/reducer'); // eslint-disable-line global-require
|
||||
const sagas = require('containers/Edit/sagas'); // eslint-disable-line global-require
|
||||
const component = require('containers/Edit'); // eslint-disable-line global-require
|
||||
const reducer = require('./containers/Edit/reducer'); // eslint-disable-line global-require
|
||||
const sagas = require('./containers/Edit/sagas'); // eslint-disable-line global-require
|
||||
const component = require('./containers/Edit'); // eslint-disable-line global-require
|
||||
|
||||
const renderRoute = loadModule(cb);
|
||||
|
||||
|
||||
@ -2,10 +2,11 @@
|
||||
* Create the store with asynchronously loaded reducers
|
||||
*/
|
||||
|
||||
import { createStore, applyMiddleware, compose } from 'redux';
|
||||
import createSagaMiddleware from 'redux-saga';
|
||||
import { applyMiddleware, compose, createStore } from 'redux';
|
||||
import { fromJS } from 'immutable';
|
||||
import { routerMiddleware } from 'react-router-redux';
|
||||
import createSagaMiddleware from 'redux-saga';
|
||||
|
||||
import createReducer from './reducers';
|
||||
|
||||
const sagaMiddleware = createSagaMiddleware();
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
import { conformsTo, isEmpty, isFunction, isObject, isString } from 'lodash';
|
||||
import invariant from 'invariant';
|
||||
import warning from 'warning';
|
||||
import createReducer from 'reducers';
|
||||
|
||||
import createReducer from '../reducers';
|
||||
|
||||
/**
|
||||
* Validate the shape of redux store
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
const resolve = require('path').resolve;
|
||||
|
||||
const pullAll = require('lodash/pullAll');
|
||||
const uniq = require('lodash/uniq');
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
const componentGenerator = require('./component/index.js');
|
||||
const containerGenerator = require('./container/index.js');
|
||||
const routeGenerator = require('./route/index.js');
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
* Route Generator
|
||||
*/
|
||||
const fs = require('fs');
|
||||
|
||||
const componentExists = require('../utils/componentExists');
|
||||
|
||||
function reducerExists(comp) {
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
const webpackConfig = require('../webpack/webpack.test.babel');
|
||||
const argv = require('minimist')(process.argv.slice(2));
|
||||
const path = require('path');
|
||||
|
||||
const argv = require('minimist')(process.argv.slice(2));
|
||||
|
||||
const webpackConfig = require('../webpack/webpack.test.babel');
|
||||
|
||||
module.exports = (config) => {
|
||||
config.set({
|
||||
frameworks: ['mocha'],
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
*/
|
||||
|
||||
const path = require('path');
|
||||
|
||||
const webpack = require('webpack');
|
||||
|
||||
module.exports = (options) => ({
|
||||
@ -65,7 +66,7 @@ module.exports = (options) => ({
|
||||
new webpack.NamedModulesPlugin(),
|
||||
]),
|
||||
resolve: {
|
||||
modules: ['app', 'node_modules'],
|
||||
modules: ['node_modules'],
|
||||
extensions: [
|
||||
'.js',
|
||||
'.jsx',
|
||||
|
||||
@ -4,12 +4,8 @@
|
||||
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const webpack = require('webpack');
|
||||
const logger = require('../../server/logger');
|
||||
const pkg = require(path.resolve(process.cwd(), 'package.json'));
|
||||
const dllPlugin = pkg.dllPlugin;
|
||||
const pluginId = pkg.name.replace(/^strapi-/i, '');
|
||||
|
||||
const webpack = require('webpack');
|
||||
const argv = require('minimist')(process.argv.slice(2));
|
||||
// PostCSS plugins
|
||||
const cssnext = require('postcss-cssnext');
|
||||
@ -19,6 +15,12 @@ const plugins = [
|
||||
new webpack.HotModuleReplacementPlugin(), // Tell webpack we want hot reloading
|
||||
new webpack.NoErrorsPlugin(),
|
||||
];
|
||||
|
||||
const logger = require('../../server/logger');
|
||||
|
||||
const pkg = require(path.resolve(process.cwd(), 'package.json'));
|
||||
const dllPlugin = pkg.dllPlugin;
|
||||
const pluginId = pkg.name.replace(/^strapi-/i, '');
|
||||
const port = argv.port || process.env.PORT || 3000;
|
||||
|
||||
module.exports = require('./webpack.base.babel')({
|
||||
|
||||
@ -9,13 +9,14 @@
|
||||
*/
|
||||
|
||||
const { join } = require('path');
|
||||
|
||||
const defaults = require('lodash/defaultsDeep');
|
||||
const webpack = require('webpack');
|
||||
const pkg = require(join(process.cwd(), 'package.json'));
|
||||
|
||||
const dllPlugin = require('../config').dllPlugin;
|
||||
|
||||
const pkg = require(join(process.cwd(), 'package.json'));
|
||||
if (!pkg.dllPlugin) { process.exit(0); }
|
||||
|
||||
const dllConfig = defaults(pkg.dllPlugin, dllPlugin.defaults);
|
||||
const outputPath = join(process.cwd(), dllConfig.path);
|
||||
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
// Important modules this config uses
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
const pkg = require(path.resolve(process.cwd(), 'package.json'));
|
||||
const pluginId = pkg.name.replace(/^strapi-/i, '');
|
||||
|
||||
// PostCSS plugins
|
||||
const cssnext = require('postcss-cssnext');
|
||||
const postcssFocus = require('postcss-focus');
|
||||
const postcssReporter = require('postcss-reporter');
|
||||
const webpack = require('webpack');
|
||||
|
||||
const pkg = require(path.resolve(process.cwd(), 'package.json'));
|
||||
const pluginId = pkg.name.replace(/^strapi-/i, '');
|
||||
|
||||
module.exports = require('./webpack.base.babel')({
|
||||
// In production, we skip all hot-reloading stuff
|
||||
|
||||
@ -3,9 +3,10 @@
|
||||
*/
|
||||
|
||||
const path = require('path');
|
||||
|
||||
const webpack = require('webpack');
|
||||
|
||||
const modules = [
|
||||
'app',
|
||||
'node_modules',
|
||||
];
|
||||
|
||||
|
||||
@ -114,13 +114,26 @@
|
||||
2,
|
||||
"always-multiline"
|
||||
],
|
||||
"import/imports-first": 0,
|
||||
"import/newline-after-import": 0,
|
||||
"import/no-dynamic-require": 0,
|
||||
"import/no-extraneous-dependencies": 0,
|
||||
"import/no-named-as-default": 0,
|
||||
"import/no-unresolved": 2,
|
||||
"import/prefer-default-export": 0,
|
||||
"import/order": [
|
||||
"error",
|
||||
{
|
||||
"groups": [
|
||||
"builtin",
|
||||
"external",
|
||||
"internal",
|
||||
"parent",
|
||||
"sibling",
|
||||
"index"
|
||||
]
|
||||
}
|
||||
],
|
||||
"import/imports-first": 2,
|
||||
"indent": [
|
||||
2,
|
||||
2,
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
/* eslint consistent-return:0 */
|
||||
|
||||
const express = require('express');
|
||||
const logger = require('./logger');
|
||||
|
||||
const argv = require('minimist')(process.argv.slice(2));
|
||||
const setup = require('./middlewares/frontendMiddleware');
|
||||
const resolve = require('path').resolve;
|
||||
|
||||
const express = require('express');
|
||||
const argv = require('minimist')(process.argv.slice(2));
|
||||
|
||||
const logger = require('./logger');
|
||||
const setup = require('./middlewares/frontendMiddleware');
|
||||
|
||||
const app = express();
|
||||
|
||||
setup(app, {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user