diff --git a/.eslintrc-calypso.js b/.eslintrc-calypso.js
new file mode 100644
index 0000000000000..5549c5e45041d
--- /dev/null
+++ b/.eslintrc-calypso.js
@@ -0,0 +1,57 @@
+/** @format */
+
+const reactVersion = require( './package.json' ).dependencies.react;
+
+module.exports = {
+ root: true,
+ extends: [
+ 'wpcalypso/react',
+ 'plugin:jsx-a11y/recommended',
+ // 'prettier',
+ // 'prettier/react',
+ ],
+ parser: 'babel-eslint',
+ env: {
+ browser: true,
+ mocha: true,
+ node: true,
+ jquery: true
+ },
+ plugins: [ 'jsx-a11y', 'lodash' ],
+ settings: {
+ react: {
+ version: reactVersion,
+ },
+ },
+ rules: {
+ // REST API objects include underscores
+ camelcase: 0,
+
+ // TODO: shorten all long lines
+ 'max-len': 0,
+
+ // i18n-calypso translate triggers false failures
+ 'jsx-a11y/anchor-has-content': 0,
+
+ 'wpcalypso/jsx-classname-namespace': 0,
+ // enforce our classname namespacing rules
+ // 'wpcalypso/jsx-classname-namespace': [
+ // 2,
+ // {
+ // rootFiles: [ 'index.js', 'index.jsx', 'main.js', 'main.jsx' ],
+ // },
+ // ],
+
+ // Force folks to use our custom combineReducers function instead of the plain redux one
+ // This allows us to control serialization for every reducer.
+ 'wpcalypso/import-no-redux-combine-reducers': 2,
+
+ // No applicable in Jetpack
+ 'wpcalypso/import-no-redux-combine-reducers': 0,
+
+ // TODO: migrate to ES6 Classes
+ 'react/prefer-es6-class': 0,
+
+ 'jsx-a11y/no-static-element-interactions': 0,
+ },
+};
diff --git a/.eslintrc.js b/.eslintrc.js
index 4d7c9282a0a47..23e2d87484f83 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -61,7 +61,7 @@ module.exports = {
"react/no-did-mount-set-state": 2,
"react/no-did-update-set-state": 2,
"react/no-is-mounted": 2,
- "react/prefer-es6-class": 1,
+ "react/prefer-es6-class": 0,
"semi": 2,
"semi-spacing": 2,
"space-before-blocks": [ 2, "always" ],
diff --git a/_inc/client/at-a-glance/index.jsx b/_inc/client/at-a-glance/index.jsx
index c86fe89c74f78..dd79dd253c2da 100644
--- a/_inc/client/at-a-glance/index.jsx
+++ b/_inc/client/at-a-glance/index.jsx
@@ -47,6 +47,10 @@ const renderPairs = layout => layout.map( item => (
) );
class AtAGlance extends Component {
+ trackSecurityClick() {
+ analytics.tracks.recordJetpackClick( 'aag_manage_security_wpcom' );
+ }
+
render() {
const settingsProps = {
updateOptions: this.props.updateOptions,
@@ -57,7 +61,6 @@ class AtAGlance extends Component {
siteAdminUrl: this.props.siteAdminUrl,
siteRawUrl: this.props.siteRawUrl
};
- const trackSecurityClick = () => analytics.tracks.recordJetpackClick( 'aag_manage_security_wpcom' );
const securityHeader = ;
const connections = (
diff --git a/_inc/client/at-a-glance/monitor.jsx b/_inc/client/at-a-glance/monitor.jsx
index 710827f9c072e..c798a4ffaa63e 100644
--- a/_inc/client/at-a-glance/monitor.jsx
+++ b/_inc/client/at-a-glance/monitor.jsx
@@ -20,6 +20,18 @@ class DashMonitor extends Component {
isModuleAvailable: PropTypes.bool.isRequired,
};
+ activateAndTrack() {
+ analytics.tracks.recordEvent(
+ 'jetpack_wpa_module_toggle',
+ {
+ module: 'monitor',
+ toggled: 'on'
+ }
+ );
+
+ this.props.updateOptions( { monitor: true } );
+ }
+
getContent() {
const labelName = __( 'Downtime monitoring' );
@@ -28,18 +40,6 @@ class DashMonitor extends Component {
link: 'https://jetpack.com/support/monitor/',
};
- const activateAndTrack = () => {
- analytics.tracks.recordEvent(
- 'jetpack_wpa_module_toggle',
- {
- module: 'monitor',
- toggled: 'on'
- }
- );
-
- this.props.updateOptions( { monitor: true } );
- };
-
if ( this.props.getOptionValue( 'monitor' ) ) {
return (
+ a:
}
}
)
diff --git a/_inc/client/at-a-glance/photon.jsx b/_inc/client/at-a-glance/photon.jsx
index eab5a55a4cdd8..bbe318837817e 100644
--- a/_inc/client/at-a-glance/photon.jsx
+++ b/_inc/client/at-a-glance/photon.jsx
@@ -19,10 +19,12 @@ class DashPhoton extends Component {
isModuleAvailable: PropTypes.bool.isRequired,
};
- getContent() {
- const labelName = __( 'Image Performance' ),
- activatePhoton = () => this.props.updateOptions( { photon: true } );
+ activatePhoton() {
+ this.props.updateOptions( { photon: true } );
+ }
+ getContent() {
+ const labelName = __( 'Image Performance' );
const support = {
text: __( 'Jetpack will optimize your images and serve them from the server location nearest to your visitors. Using our global content delivery network will boost the loading speed of your site.' ),
link: 'https://jetpack.com/support/photon/',
@@ -51,7 +53,7 @@ class DashPhoton extends Component {
this.props.isDevMode ? __( 'Unavailable in Dev Mode' )
: __( '{{a}}Activate{{/a}} to enhance the performance and speed of your images.', {
components: {
- a:
+ a:
}
}
)
diff --git a/_inc/client/at-a-glance/protect.jsx b/_inc/client/at-a-glance/protect.jsx
index 6102c0347b5fa..3c352178c1cdb 100644
--- a/_inc/client/at-a-glance/protect.jsx
+++ b/_inc/client/at-a-glance/protect.jsx
@@ -22,12 +22,15 @@ class DashProtect extends Component {
isModuleAvailable: PropTypes.bool.isRequired,
};
+ activateProtect() {
+ this.props.updateOptions( { protect: true } );
+ }
+
getContent() {
const support = {
text: __( 'Protects your site from traditional and distributed brute force login attacks.' ),
link: 'https://jetpack.com/support/protect/',
};
- const activateProtect = () => this.props.updateOptions( { protect: true } );
if ( this.props.getOptionValue( 'protect' ) ) {
const protectCount = this.props.protectCount;
@@ -72,7 +75,7 @@ class DashProtect extends Component {
this.props.isDevMode ? __( 'Unavailable in Dev Mode' )
: __( '{{a}}Activate Protect{{/a}} to keep your site protected from malicious sign in attempts.', {
components: {
- a:
+ a:
}
}
)
diff --git a/_inc/client/at-a-glance/search.jsx b/_inc/client/at-a-glance/search.jsx
index 7c679d4c23c85..2c57e9235be18 100644
--- a/_inc/client/at-a-glance/search.jsx
+++ b/_inc/client/at-a-glance/search.jsx
@@ -55,9 +55,12 @@ class DashSearch extends Component {
isDevMode: false,
};
+ activateSearch() {
+ this.props.updateOptions( { search: true } );
+ }
+
render() {
- const hasPro = ( 'is-business-plan' === this.props.planClass ),
- activateSearch = () => this.props.updateOptions( { search: true } );
+ const hasPro = ( 'is-business-plan' === this.props.planClass );
if ( this.props.isDevMode ) {
return renderCard( {
@@ -111,7 +114,7 @@ class DashSearch extends Component {
pro_inactive: false,
content: __( '{{a}}Activate{{/a}} to replace the WordPress built-in search with Jetpack Search, an advanced search experience.', {
components: {
- a:
+ a:
}
} )
} );
diff --git a/_inc/client/at-a-glance/stats/dash-stats-bottom.jsx b/_inc/client/at-a-glance/stats/dash-stats-bottom.jsx
index 06a103c72f499..b285bc28cbb37 100644
--- a/_inc/client/at-a-glance/stats/dash-stats-bottom.jsx
+++ b/_inc/client/at-a-glance/stats/dash-stats-bottom.jsx
@@ -41,10 +41,16 @@ class DashStatsBottom extends Component {
];
}
+ trackViewDetailedStats() {
+ analytics.tracks.recordJetpackClick( 'view_detailed_stats' );
+ }
+
+ trackViewWpcomStats() {
+ analytics.tracks.recordJetpackClick( 'view_wpcom_stats' );
+ }
+
render() {
const s = this.statsBottom()[ 0 ];
- const trackViewDetailedStats = () => analytics.tracks.recordJetpackClick( 'view_detailed_stats' ),
- trackViewWpcomStats = () => analytics.tracks.recordJetpackClick( 'view_wpcom_stats' );
return (
@@ -102,7 +108,7 @@ class DashStatsBottom extends Component {
components: {
button:
}
@@ -113,7 +119,7 @@ class DashStatsBottom extends Component {
components: {
button:
diff --git a/_inc/client/at-a-glance/stats/index.jsx b/_inc/client/at-a-glance/stats/index.jsx
index 47f7c6d484637..ac24787b8da5b 100644
--- a/_inc/client/at-a-glance/stats/index.jsx
+++ b/_inc/client/at-a-glance/stats/index.jsx
@@ -142,11 +142,12 @@ export class DashStats extends Component {
);
}
+ dismissCard() {
+ this.setState( { emptyStatsDismissed: true } );
+ this.props.updateOptions( { dismiss_empty_stats_card: true } );
+ }
+
renderEmptyStatsCard() {
- const dismissCard = () => {
- this.setState( { emptyStatsDismissed: true } );
- this.props.updateOptions( { dismiss_empty_stats_card: true } );
- };
return (
@@ -156,7 +157,7 @@ export class DashStats extends Component {
{ __( 'Just give us a little time to collect data so we can display it for you here.' ) }