Skip to content

Commit

Permalink
Merge pull request #1019 from Automattic/add/block-validation
Browse files Browse the repository at this point in the history
Add AMP validation checking for Gutenberg blocks
  • Loading branch information
westonruter authored Apr 16, 2018
2 parents 0870f00 + 5bf12da commit c15a368
Show file tree
Hide file tree
Showing 18 changed files with 1,327 additions and 180 deletions.
1 change: 1 addition & 0 deletions .dev-lib
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ SKIP_ECHO_PATHS_SCOPE=1
function after_wp_install {
echo "Installing REST API..."
svn export -q https://plugins.svn.wordpress.org/jetpack/trunk/ "$WP_CORE_DIR/src/wp-content/plugins/jetpack"
svn export -q https://plugins.svn.wordpress.org/gutenberg/trunk/ "$WP_CORE_DIR/src/wp-content/plugins/gutenberg"
}
1 change: 0 additions & 1 deletion .eslintrc

This file was deleted.

187 changes: 187 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
{
"root": true,
"extends": [
"wordpress"
],
"env": {
"browser": true
},
"globals": {
"wp": true,
"window": true,
"document": true
},
"settings": {
"react": {
"pragma": "wp"
}
},
"rules": {
"no-magic-numbers": [2, { "ignoreArrayIndexes": true, "ignore": [ -1, 0, 1 ] }],
"array-bracket-spacing": [
"error",
"always"
],
"brace-style": [
"error",
"1tbs"
],
"camelcase": [
"error",
{
"properties": "never"
}
],
"comma-dangle": [
"error",
"never"
],
"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
}
],
"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"
],
"quote-props": [
"error",
"as-needed"
],
"react/display-name": "off",
"react/no-children-prop": "off",
"react/prop-types": "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"
}
}
1 change: 0 additions & 1 deletion .jscsrc

This file was deleted.

1 change: 1 addition & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-env node */
/* jshint node:true */
/* eslint-disable camelcase */

module.exports = function( grunt ) {
'use strict';
Expand Down
13 changes: 13 additions & 0 deletions assets/css/amp-post-meta-box.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,16 @@
line-height: 280%;
}
}

.amp-block-validation-errors {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
font-size: 13px;
line-height: 1.5;
}
.amp-block-validation-errors .amp-block-validation-errors__summary {
margin: 0.5em 0;
padding: 2px;
}
.amp-block-validation-errors .amp-block-validation-errors__list {
padding-left: 2.5em;
}
Loading

0 comments on commit c15a368

Please sign in to comment.