Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Shopify related rules #123

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ Then add a `.eslintrc` with the following:

## Alternatives

* [@shopify/eslint-plugin](https://www.npmjs.com/package/@shopify/eslint-plugin)
* [eslint-config-rainbow](https://github.com/rainbow-me/eslint-config-rainbow) by [@bcomnes](https://github.com/bcomnes)
* [semistandard](https://github.com/standard/semistandard)
* [standard](https://standardjs.com/)
Expand Down
49 changes: 48 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

module.exports = {
plugins: [
'@shopify',
'es',
'import',
'jsdoc',
'mocha',
'promise',
'security',
'sort-class-members',
'sort-destructure-keys',
'unicorn'
],
Expand Down Expand Up @@ -102,6 +104,51 @@ module.exports = {

'promise/prefer-await-to-then': 'error',

'sort-destructure-keys/sort-destructure-keys': 'error'
// Borrowed from @shopify/eslint-plugin esnext rules
'sort-class-members/sort-class-members': [
'error',
{
order: [
'[static-properties]',
'[static-methods]',
'[private-properties]',
'[conventional-private-properties]',
'[properties]',
'constructor',
'[private-methods]',
'[conventional-private-methods]',
'[methods]',
],
groups: {
'private-properties': [{ type: 'property', 'static': false, 'private': true }],
'private-methods': [{ type: 'property', 'static': false, 'private': true }],
},
},
],

'sort-destructure-keys/sort-destructure-keys': 'error',

// Shopify ones

// Require (or disallow) assignments of binary, boolean-producing expressions to be wrapped in parentheses.
'@shopify/binary-assignment-parens': ['error', 'always'],
// Prevent namespace import declarations
'@shopify/no-namespace-imports': 'error',
// Prevent the usage of unnecessary computed properties.
'@shopify/no-useless-computed-properties': 'error',
// Prevent the declaration of classes consisting only of static members.
'@shopify/no-fully-static-classes': 'error',
// Prefer class properties to assignment of literals in constructors.
'@shopify/prefer-class-properties': 'error',
// Prefer early returns over full-body conditional wrapping in function declarations.
'@shopify/prefer-early-return': ['error', { maximumStatements: 1 }],
// Prefer that screaming snake case variables always be defined using `const`, and always appear at module scope.
'@shopify/prefer-module-scope-constants': 'error',
// Restrict the use of specified sinon features.
'@shopify/sinon-no-restricted-features': 'error',
// Require the use of meaningful sinon assertions through sinon.assert or sinon-chai.
'@shopify/sinon-prefer-meaningful-assertions': 'error',
// Prevent module imports between components.
'@shopify/strict-component-boundaries': 'error',
}
};
Loading