mirror of
https://github.com/strapi/strapi.git
synced 2025-12-25 14:14:10 +00:00
Add eslint to strapi-admin backend
This commit is contained in:
parent
1a5c9d45da
commit
30528f40ec
@ -14,21 +14,29 @@ import en from 'translations/en.json';
|
||||
|
||||
import styles from './styles.scss';
|
||||
|
||||
class LeftMenuLink extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
||||
class LeftMenuLink extends React.Component {
|
||||
// eslint-disable-line react/prefer-stateless-function
|
||||
render() {
|
||||
// We need to create our own active url checker,
|
||||
// because of the two levels router.
|
||||
const isLinkActive = startsWith(window.location.pathname.replace('/admin', ''), this.props.destination);
|
||||
const plugin = this.props.source !== 'content-manager' && this.props.source !== '' ?
|
||||
(<div className={styles.plugin}>
|
||||
<span>{upperFirst(this.props.source.split('-').join(' '))}</span>
|
||||
</div>) : '';
|
||||
const isLinkActive = startsWith(
|
||||
window.location.pathname.replace('/admin', ''),
|
||||
this.props.destination,
|
||||
);
|
||||
const plugin =
|
||||
this.props.source !== 'content-manager' && this.props.source !== '' ? (
|
||||
<div className={styles.plugin}>
|
||||
<span>{upperFirst(this.props.source.split('-').join(' '))}</span>
|
||||
</div>
|
||||
) : (
|
||||
''
|
||||
);
|
||||
|
||||
// Check if messageId exists in en locale to prevent warning messages
|
||||
const content = en[this.props.label] ? (
|
||||
<FormattedMessage
|
||||
id={this.props.label}
|
||||
defaultMessage='{label}'
|
||||
defaultMessage="{label}"
|
||||
values={{
|
||||
label: `${this.props.label}`,
|
||||
}}
|
||||
@ -47,7 +55,7 @@ class LeftMenuLink extends React.Component { // eslint-disable-line react/prefer
|
||||
search: this.props.source ? `?source=${this.props.source}` : '',
|
||||
}}
|
||||
>
|
||||
<i className={`${styles.linkIcon} fa-${this.props.icon} fa`}></i>
|
||||
<i className={`${styles.linkIcon} fa-${this.props.icon} fa`} />
|
||||
{content}
|
||||
</Link>
|
||||
{plugin}
|
||||
|
||||
@ -36,7 +36,7 @@ class Logout extends React.Component { // eslint-disable-line react/prefer-state
|
||||
<ButtonDropdown isOpen={this.state.isOpen} toggle={this.toggle}>
|
||||
<DropdownToggle>
|
||||
{get(auth.getUserInfo(), 'username')}
|
||||
<i className={`fa fa-caret-down`} alt={`${this.state.isOpen}`} />
|
||||
<i className="fa fa-caret-down" alt={`${this.state.isOpen}`} />
|
||||
</DropdownToggle>
|
||||
<DropdownMenu className={styles.dropDownContent}>
|
||||
<DropdownItem onClick={this.handleGoTo} className={styles.item}>
|
||||
|
||||
@ -20,6 +20,7 @@ import logoTShirt from 'assets/images/logo-t-shirt.svg';
|
||||
import styles from './styles.scss';
|
||||
import Screenshot from './screenshot.png';
|
||||
|
||||
/* eslint-disable react/no-unused-state */
|
||||
class PluginCard extends React.Component {
|
||||
state = { isOpen: false, boostrapCol: 'col-lg-4' };
|
||||
|
||||
|
||||
@ -18,9 +18,10 @@
|
||||
"prestart": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development PORT=4000 IS_ADMIN=true node ./node_modules/strapi-helper-plugin/lib/internals/scripts/loadAdminConfigurations.js",
|
||||
"start": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development PORT=4000 IS_ADMIN=true node ./node_modules/strapi-helper-plugin/lib/server",
|
||||
"generate": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/plop --plopfile ./node_modules/strapi-helper-plugin/lib/internals/generators/index.js",
|
||||
"lint": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/eslint --ignore-path ./admin/.gitignore --ignore-pattern build --config ./node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin",
|
||||
"lint:front": "node ./node_modules/strapi-lint/node_modules/.bin/eslint --ignore-path .gitignore --ignore-pattern '/admin/build/' --config ./node_modules/strapi-lint/lib/internals/eslint/front/.eslintrc.json admin",
|
||||
"lint:back": "node ./node_modules/strapi-lint/node_modules/.bin/eslint --ignore-path .gitignore --ignore-pattern '/admin/build/' --config ./node_modules/strapi-lint/lib/internals/eslint/back/.eslintrc.json controllers config services",
|
||||
"prettier": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/prettier --single-quote --trailing-comma es5 --write \"{admin,__{tests,mocks}__}/**/*.js\"",
|
||||
"test": "npm run lint",
|
||||
"test": "npm run lint:front && npm run lint:back",
|
||||
"prepublishOnly": "npm run build",
|
||||
"setup": "node ./scripts/setup.js",
|
||||
"presetup": "node ./scripts/preSetup.js"
|
||||
@ -33,6 +34,7 @@
|
||||
"devDependencies": {
|
||||
"sanitize.css": "^4.1.0",
|
||||
"strapi-helper-plugin": "3.0.0-alpha.12",
|
||||
"strapi-lint": "3.0.0-alpha.12",
|
||||
"strapi-utils": "3.0.0-alpha.12"
|
||||
},
|
||||
"author": {
|
||||
|
||||
@ -118,4 +118,4 @@
|
||||
"webpack-hot-middleware": "^2.18.2",
|
||||
"whatwg-fetch": "^2.0.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -49,4 +49,4 @@
|
||||
"npm": ">= 5.0.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
@ -79,6 +79,7 @@ watcher('📦 Linking strapi-helper-plugin...', 'npm link');
|
||||
shell.cd('../strapi-admin');
|
||||
watcher('', 'npm install ../strapi-helper-plugin --no-optional');
|
||||
watcher('', 'npm install ../strapi-utils --no-optional');
|
||||
watcher('', 'npm install ../strapi-lint --no-optional');
|
||||
shell.rm('-f', 'package-lock.json');
|
||||
|
||||
// Without these line Travis failed.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user