-
Notifications
You must be signed in to change notification settings - Fork 316
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
Update for latest gutenberg compatibility #23
Merged
Merged
Changes from 10 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
68f28d7
Update for gutenberg 2.9 compatibility
ajitbohra a52df7c
Add text domain & setLocale
ajitbohra 5c0d85d
Fix coding standards
ajitbohra feb53a7
Config eslint & fix code
ajitbohra f4b1aba
Merge branch 'master' of github.com:ajitbohra/gutenberg-examples
ajitbohra 151bd61
Load locale data & refactor assets loading
ajitbohra 2518aae
Clean .gitignore & .eslintignore
ajitbohra 112440d
Use var for es5 examples instead of const
ajitbohra 87b8161
Move gutenberg check to top
ajitbohra 455d715
Handle undefined alignment
ajitbohra 91c1699
Merge branch 'master' into master
ajitbohra 0f82a2d
Fix className on save
ajitbohra eb2d489
Merge branch 'master' of github.com:ajitbohra/gutenberg-examples
ajitbohra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
node_modules | ||
*.build.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
module.exports = { | ||
extends: [ | ||
'wordpress', | ||
'plugin:wordpress/esnext', | ||
'plugin:react/recommended', | ||
'plugin:jsx-a11y/recommended', | ||
], | ||
env: { | ||
browser: false, | ||
es6: true, | ||
node: true, | ||
}, | ||
parserOptions: { | ||
sourceType: 'module', | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
globals: { | ||
wp: true, | ||
window: true, | ||
document: true, | ||
}, | ||
plugins: [ | ||
'wordpress', | ||
'react', | ||
'jsx-a11y', | ||
], | ||
rules: { | ||
'array-bracket-spacing': [ 'error', 'always' ], | ||
'arrow-parens': [ 'error', 'always' ], | ||
'arrow-spacing': 'error', | ||
'brace-style': [ 'error', '1tbs' ], | ||
camelcase: [ 'error', { properties: 'never' } ], | ||
'comma-dangle': [ 'error', 'always-multiline' ], | ||
'comma-spacing': 'error', | ||
'comma-style': 'error', | ||
'computed-property-spacing': [ 'error', 'always' ], | ||
'dot-notation': 'error', | ||
'eol-last': 'error', | ||
eqeqeq: 'error', | ||
'func-call-spacing': 'error', | ||
indent: [ 'error', 'tab', { SwitchCase: 1 } ], | ||
'jsx-a11y/label-has-for': [ 'error', { | ||
required: 'id', | ||
} ], | ||
'jsx-a11y/media-has-caption': 'off', | ||
'jsx-a11y/no-noninteractive-tabindex': 'off', | ||
'jsx-a11y/role-has-required-aria-props': 'off', | ||
'jsx-quotes': 'error', | ||
'key-spacing': 'error', | ||
'keyword-spacing': 'error', | ||
'lines-around-comment': 'off', | ||
'no-alert': 'error', | ||
'no-bitwise': 'error', | ||
'no-caller': 'error', | ||
'no-console': 'error', | ||
'no-debugger': 'error', | ||
'no-dupe-args': 'error', | ||
'no-dupe-keys': 'error', | ||
'no-duplicate-case': 'error', | ||
'no-else-return': 'error', | ||
'no-eval': 'error', | ||
'no-extra-semi': 'error', | ||
'no-fallthrough': 'error', | ||
'no-lonely-if': 'error', | ||
'no-mixed-operators': 'error', | ||
'no-mixed-spaces-and-tabs': 'error', | ||
'no-multiple-empty-lines': [ 'error', { max: 1 } ], | ||
'no-multi-spaces': 'error', | ||
'no-multi-str': 'off', | ||
'no-negated-in-lhs': 'error', | ||
'no-nested-ternary': 'error', | ||
'no-redeclare': 'error', | ||
'no-restricted-syntax': [ | ||
'error', | ||
{ | ||
selector: 'CallExpression[callee.name=/^__|_n|_x$/]:not([arguments.0.type=/^Literal|BinaryExpression$/])', | ||
message: 'Translate function arguments must be string literals.', | ||
}, | ||
{ | ||
selector: 'CallExpression[callee.name=/^_n|_x$/]:not([arguments.1.type=/^Literal|BinaryExpression$/])', | ||
message: 'Translate function arguments must be string literals.', | ||
}, | ||
{ | ||
selector: 'CallExpression[callee.name=_nx]:not([arguments.2.type=/^Literal|BinaryExpression$/])', | ||
message: 'Translate function arguments must be string literals.', | ||
}, | ||
], | ||
'no-shadow': 'error', | ||
'no-undef': 'error', | ||
'no-undef-init': 'error', | ||
'no-unreachable': 'error', | ||
'no-unsafe-negation': 'error', | ||
'no-unused-expressions': 'error', | ||
'no-unused-vars': 'error', | ||
'no-useless-return': 'error', | ||
'no-whitespace-before-property': 'error', | ||
'object-curly-spacing': [ 'error', 'always' ], | ||
'padded-blocks': [ 'error', 'never' ], | ||
quotes: [ 'error', 'single', { allowTemplateLiterals: true, avoidEscape: true } ], | ||
'quote-props': [ 'error', 'as-needed' ], | ||
'react/display-name': 'off', | ||
'react/jsx-curly-spacing': [ 'error', { | ||
when: 'always', | ||
children: true, | ||
} ], | ||
'react/jsx-equals-spacing': 'error', | ||
'react/jsx-indent': [ 'error', 'tab' ], | ||
'react/jsx-indent-props': [ 'error', 'tab' ], | ||
'react/jsx-key': 'error', | ||
'react/jsx-tag-spacing': 'error', | ||
'react/no-children-prop': 'off', | ||
'react/prop-types': 'off', | ||
'react/react-in-jsx-scope': 'off', | ||
semi: 'error', | ||
'semi-spacing': 'error', | ||
'space-before-blocks': [ 'error', 'always' ], | ||
'space-before-function-paren': [ 'error', { | ||
anonymous: 'never', | ||
named: 'never', | ||
asyncArrow: 'always', | ||
} ], | ||
'space-in-parens': [ 'error', 'always' ], | ||
'space-infix-ops': [ 'error', { int32Hint: false } ], | ||
'space-unary-ops': [ 'error', { | ||
overrides: { | ||
'!': true, | ||
yield: true, | ||
}, | ||
} ], | ||
'valid-jsdoc': [ 'error', { | ||
prefer: { | ||
arg: 'param', | ||
argument: 'param', | ||
extends: 'augments', | ||
returns: 'return', | ||
}, | ||
preferType: { | ||
array: 'Array', | ||
bool: 'boolean', | ||
Boolean: 'boolean', | ||
float: 'number', | ||
Float: 'number', | ||
int: 'number', | ||
integer: 'number', | ||
Integer: 'number', | ||
Number: 'number', | ||
object: 'Object', | ||
String: 'string', | ||
Void: 'void', | ||
}, | ||
requireParamDescription: false, | ||
requireReturn: false, | ||
} ], | ||
'valid-typeof': 'error', | ||
yoda: 'off', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Directories/files that may be generated by this project | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Many of these don't exist in this repository:
|
||
node_modules | ||
|
||
# Directories/files that may appear in your environment | ||
.DS_Store | ||
*.log | ||
/yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is prone to falling out of sync. Is okay for now, but we should try to push WordPress/gutenberg#7965 and update to use the single configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes waiting for eslint config to be published as a package will simplify things