Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

Commit

Permalink
Run eslint --fix with prettier config
Browse files Browse the repository at this point in the history
  • Loading branch information
ismail-syed committed Oct 12, 2017
1 parent 1d33e1f commit 69e3495
Show file tree
Hide file tree
Showing 26 changed files with 440 additions and 329 deletions.
2 changes: 1 addition & 1 deletion lib/config/all.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var merge = require('merge');
const merge = require('merge');

module.exports = {
parser: 'babel-eslint',
Expand Down
4 changes: 1 addition & 3 deletions lib/config/ava.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ module.exports = {
sourceType: 'module',
},

plugins: [
'ava',
],
plugins: ['ava'],

rules: require('./rules/ava'),
};
6 changes: 2 additions & 4 deletions lib/config/core.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
var merge = require('merge');
const merge = require('merge');

module.exports = {
plugins: [
'shopify',
],
plugins: ['shopify'],

parserOptions: {
ecmaFeatures: {
Expand Down
14 changes: 3 additions & 11 deletions lib/config/esnext.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var merge = require('merge');
const merge = require('merge');

module.exports = {
extends: 'plugin:shopify/core',
Expand All @@ -16,18 +16,10 @@ module.exports = {
},
},

plugins: [
'babel',
'promise',
'sort-class-members',
'import',
],
plugins: ['babel', 'promise', 'sort-class-members', 'import'],

settings: {
'import/ignore': [
'node_modules',
'\\.s?css',
],
'import/ignore': ['node_modules', '\\.s?css'],
},

rules: merge(
Expand Down
11 changes: 3 additions & 8 deletions lib/config/flow.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var merge = require('merge');
const merge = require('merge');

module.exports = {
parser: 'babel-eslint',
Expand All @@ -12,12 +12,7 @@ module.exports = {
sourceType: 'module',
},

plugins: [
'flowtype',
'shopify',
],
plugins: ['flowtype', 'shopify'],

rules: merge(
require('./rules/flowtype')
),
rules: merge(require('./rules/flowtype')),
};
4 changes: 1 addition & 3 deletions lib/config/jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ module.exports = {
jquery: true,
},

plugins: [
'shopify',
],
plugins: ['shopify'],

rules: {
'shopify/jquery-dollar-sign-reference': 'warn',
Expand Down
4 changes: 1 addition & 3 deletions lib/config/lodash.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module.exports = {
plugins: [
'lodash',
],
plugins: ['lodash'],

rules: require('./rules/lodash'),
};
26 changes: 9 additions & 17 deletions lib/config/mocha.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
var merge = require('merge');
const merge = require('merge');

module.exports = {
env: {
mocha: true,
},

plugins: [
'mocha',
'chai-expect',
'shopify',
],
plugins: ['mocha', 'chai-expect', 'shopify'],

rules: merge(
require('./rules/mocha'),
require('./rules/chai-expect'),
{
'shopify/sinon-prefer-meaningful-assertions': 'warn',
// Chai expect syntax produces unused expression warnings
'no-unused-expressions': 'off',
// Chai expect syntax can have long chained calls
'newline-per-chained-call': 'off',
}
),
rules: merge(require('./rules/mocha'), require('./rules/chai-expect'), {
'shopify/sinon-prefer-meaningful-assertions': 'warn',
// Chai expect syntax produces unused expression warnings
'no-unused-expressions': 'off',
// Chai expect syntax can have long chained calls
'newline-per-chained-call': 'off',
}),
};
4 changes: 1 addition & 3 deletions lib/config/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ module.exports = {
node: true,
},

plugins: [
'node',
],
plugins: ['node'],

rules: require('./rules/node'),
};
24 changes: 10 additions & 14 deletions lib/config/react.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var merge = require('merge');
const merge = require('merge');

module.exports = {
extends: 'plugin:shopify/esnext',
Expand All @@ -17,17 +17,13 @@ module.exports = {
ReactClass: true,
},

plugins: [
'react',
'jsx-a11y',
],
plugins: ['react', 'jsx-a11y'],

rules: merge(
require('./rules/react'),
require('./rules/jsx-a11y'),
{
// Not using `this` is fine in some lifecycle hooks
'class-methods-use-this': ['warn', {
rules: merge(require('./rules/react'), require('./rules/jsx-a11y'), {
// Not using `this` is fine in some lifecycle hooks
'class-methods-use-this': [
'warn',
{
exceptMethods: [
'render',
'getChildContext',
Expand All @@ -39,7 +35,7 @@ module.exports = {
'componentDidUpdate',
'componentWillUnmount',
],
}],
}
),
},
],
}),
};
10 changes: 5 additions & 5 deletions lib/config/rules/best-practices.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ module.exports = {
// Enforce that class methods utilize this
'class-methods-use-this': 'warn',
// Specify the maximum cyclomatic complexity allowed in a program
'complexity': 'off',
complexity: 'off',
// Require return statements to either always or never specify values
'consistent-return': 'warn',
// Specify curly brace conventions for all control statements
'curly': ['warn', 'all'],
curly: ['warn', 'all'],
// Require default case in switch statements
'default-case': 'off',
// Encourages use of dot notation whenever possible
'dot-notation': ['warn', {allowKeywords: true}],
// Enforces consistent newlines before or after dots
'dot-location': ['warn', 'property'],
// Require the use of === and !==
'eqeqeq': ['error', 'allow-null'],
eqeqeq: ['error', 'allow-null'],
// Make sure for-in loops have an if statement
'guard-for-in': 'warn',
// Disallow the use of alert, confirm, and prompt
Expand Down Expand Up @@ -135,13 +135,13 @@ module.exports = {
// Require using Error objects as Promise rejection reasons
'prefer-promise-reject-errors': ['error', {allowEmptyReject: true}],
// Require use of the second argument for parseInt()
'radix': 'error',
radix: 'error',
// Disallow async functions which have no await expression
'require-await': 'error',
// Requires to declare all vars on top of their containing scope
'vars-on-top': 'off',
// Require immediate function invocation to be wrapped in parentheses
'wrap-iife': ['warn', 'inside'],
// Require or disallow Yoda conditions
'yoda': ['warn', 'never'],
yoda: ['warn', 'never'],
};
13 changes: 8 additions & 5 deletions lib/config/rules/flowtype.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ module.exports = {
// Disallows Flow type imports, aliases, and annotations in files missing a valid Flow file declaration (or a @noflow annotation).
'flowtype/no-types-missing-file-annotation': 'error',
// Warns against weak type annotations any, Object and Function.
'flowtype/no-weak-types': ['error', {
any: false,
Object: false,
Function: true,
}],
'flowtype/no-weak-types': [
'error',
{
any: false,
Object: false,
Function: true,
},
],
// Enforces consistent separators between properties in Flow object types.
'flowtype/object-type-delimiter': ['warn', 'comma'],
// Requires that all function parameters have type annotations.
Expand Down
12 changes: 6 additions & 6 deletions lib/config/rules/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ module.exports = {
// Ensure consistent use of file extension within the import path
'import/extensions': ['warn', {js: 'never', json: 'always'}],
// Enforce a convention in module import order
'import/order': ['warn', {
groups: [
['builtin', 'external'],
['internal', 'parent', 'sibling'],
],
}],
'import/order': [
'warn',
{
groups: [['builtin', 'external'], ['internal', 'parent', 'sibling']],
},
],
// Enforce a newline after import statements
'import/newline-after-import': 'warn',
// Prefer a default export if module exports a single name
Expand Down
1 change: 0 additions & 1 deletion lib/config/rules/promise.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ module.exports = {
// Avoid creating new promises outside of utility libs (use pify instead)
'promise/avoid-new': 'off',


// Async/Await Rules

// Prefer await to then() for reading Promise values
Expand Down
42 changes: 26 additions & 16 deletions lib/config/rules/stylistic-issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
// Enforce one true brace style
'brace-style': ['warn', '1tbs', {allowSingleLine: true}],
// Require camel case names
'camelcase': ['warn', {properties: 'always'}],
camelcase: ['warn', {properties: 'always'}],
// Enforce or disallow capitalization of the first letter of a comment
'capitalized-comments': 'off',
// Enforce spacing before and after comma
Expand All @@ -38,15 +38,18 @@ module.exports = {
// Blacklist certain identifiers to prevent them being used
'id-blacklist': 'off',
// This option enforces minimum and maximum identifier lengths (variable names, property names etc.)
'id-length': ['warn', {
min: 2,
properties: 'always',
exceptions: ['x', 'y', 'i', 'j', 't', '_', '$'],
}],
'id-length': [
'warn',
{
min: 2,
properties: 'always',
exceptions: ['x', 'y', 'i', 'j', 't', '_', '$'],
},
],
// Require identifiers to match the provided regular expression
'id-match': 'off',
// Disable eslint v4 stricter indent rules
'indent': 'off',
indent: 'off',
// Use eslint v3 indent rules: This option sets a specific tab width for your code
'indent-legacy': ['warn', 2, {SwitchCase: 1, MemberExpression: 1}],
// Specify whether double or single quotes should be used in JSX attributes
Expand Down Expand Up @@ -132,35 +135,42 @@ module.exports = {
// Require assignment operator shorthand where possible or prohibit it entirely
'operator-assignment': ['warn', 'always'],
// Enforce operators to be placed before or after line breaks
'operator-linebreak': ['warn', 'after', {overrides: {'?': 'before', ':': 'before'}}],
'operator-linebreak': [
'warn',
'after',
{overrides: {'?': 'before', ':': 'before'}},
],
// Enforce padding within blocks
'padded-blocks': 'off',
// require or disallow padding lines between statements
'padding-line-between-statements': 'off',
// Require quotes around object literal property names
'quote-props': ['warn', 'as-needed'],
// Specify whether backticks, double or single quotes should be used
'quotes': ['warn', 'single', 'avoid-escape'],
quotes: ['warn', 'single', 'avoid-escape'],
// Require JSDoc comments
'require-jsdoc': 'off',
// Enforce spacing before and after semicolons
'semi-spacing': ['warn', {before: false, after: true}],
// enforce location of semicolons
'semi-style': ['error', 'last'],
// Require or disallow use of semicolons instead of ASI
'semi': ['warn', 'always'],
semi: ['warn', 'always'],
// Requires object keys to be sorted
'sort-keys': 'off',
// Sort variables within the same declaration block
'sort-vars': 'off',
// Require or disallow space before blocks
'space-before-blocks': ['warn', 'always'],
// Require or disallow space before function opening parenthesis
'space-before-function-paren': ['error', {
anonymous: 'never',
named: 'never',
asyncArrow: 'always',
}],
'space-before-function-paren': [
'error',
{
anonymous: 'never',
named: 'never',
asyncArrow: 'always',
},
],
// Require or disallow spaces inside parentheses
'space-in-parens': ['warn', 'never'],
// Require spaces around operators
Expand All @@ -170,7 +180,7 @@ module.exports = {
// Require or disallow a space immediately following the // or /* in a comment
'spaced-comment': ['warn', 'always', {markers: ['=']}],
// enforce spacing around colons of switch statements
'switch-colon-spacing': ['error', {'after': true, 'before': false}],
'switch-colon-spacing': ['error', {after: true, before: false}],
// Require or disallow spacing between template tags and their literals
'template-tag-spacing': ['error', 'never'],
// Require or disallow the Unicode BOM
Expand Down
Loading

0 comments on commit 69e3495

Please sign in to comment.