Skip to content
This repository was archived by the owner on Apr 16, 2020. It is now read-only.

Commit

Permalink
Merge pull request #92 from skaut/lint
Browse files Browse the repository at this point in the history
Lint
  • Loading branch information
marekdedic authored Sep 6, 2019
2 parents 487a044 + 6d26e02 commit cfb195e
Show file tree
Hide file tree
Showing 53 changed files with 11,292 additions and 7,592 deletions.
32 changes: 32 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ workflows:
main:
jobs:
- build
- lint:
requires:
- build

job-references:
restore_composer: &restore_composer
Expand Down Expand Up @@ -51,3 +54,32 @@ jobs:
- run:
name: "Build"
command: npm run build:prod
- persist_to_workspace:
root: dist
paths:
- "*"
lint:
docker:
- image: circleci/php:7.3-node
steps:
- checkout

- restore_cache: *restore_composer
- run: *install_composer
- save_cache: *save_composer

- restore_cache: *restore_npm
- run: *install_npm
- save_cache: *save_npm

- attach_workspace:
at: dist

- run:
name: "Install php-ast"
command: |
sudo pecl install ast
echo 'extension=ast.so' | sudo tee /usr/local/etc/php/php.ini > /dev/null
- run:
name: "Lint"
command: npm run lint
14 changes: 14 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"env": {
"browser": true
},
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": ["compat"],
"extends": "wordpress",
"rules": {
"compat/compat": "warn"
}
}
35 changes: 35 additions & 0 deletions .phan/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* PHAN configuration
*
* @package crdm-basic
*/

return [
'target_php_version' => '7.3',
'backward_compatibility_checks' => false,
'analyze_signature_compatibility' => true,
'minimum_severity' => 0,
'directory_list' => [
'src',
'.phan',
'dist/vendor',
],
'exclude_analysis_directory_list' => [
'dist/vendor/',
],
'suppress_issue_types' => [
],
'plugins' => [
'AlwaysReturnPlugin',
'DuplicateArrayKeyPlugin',
'PregRegexCheckerPlugin',
'UnreachableCodePlugin',
'NonBoolBranchPlugin',
'NonBoolInLogicalArithPlugin',
'InvalidVariableIssetPlugin',
'NoAssertPlugin',
'DuplicateExpressionPlugin',
'DollarDollarPlugin',
],
];
111 changes: 111 additions & 0 deletions .phan/stubs/WordPress/functions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<?php
/**
* Contains WordPress function stubs for PHAN
*
* @package skaut-google-drive-gallery
*/

function add_action( $a, $b, $c = '' ) {
}

function add_filter( $a, $b, $c ) {
}

function apply_filters( $a, $b ) {
return '';
}

function do_action( $a ) {
}

function esc_attr( $a ) {
return '';
}

function esc_attr__( $a, $b ) {
return '';
}

function esc_html( $a ) {
return '';
}

function esc_html__( $a, $b ) {
return '';
}

function get_option( $a, $b ) {
switch ( wp_rand( 0, 2 ) ) {
case 0:
return [];
case 1:
return false;
case 2:
return '';
}
}

function get_stylesheet_directory() {
return '';
}

function get_stylesheet_directory_uri() {
return '';
}

function get_template_directory() {
return '';
}

function get_template_directory_uri() {
return '';
}

function get_theme_mod( $a ) {
return [];
}

function has_post_thumbnail() {
return false;
}

function is_admin() {
return false;
}

function is_page() {
return false;
}

function is_rtl() {
return false;
}

function remove_action( $a, $b, $c = '' ) {
return false;
}

function switch_theme( $a ) {
}

function the_post_thumbnail( $a, $b ) {
}

function the_title() {
}

function the_title_attribute( $a ) {
}

function trailingslashit( $a ) {
return '';
}

function wp_enqueue_script( $a, $b, $c, $d, $e ) {
}

function wp_enqueue_style( $a, $b, $c, $d ) {
}

function wp_rand( $a, $b ) {
}
19 changes: 19 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": "stylelint-config-wordpress",
"plugins": [
"stylelint-no-unsupported-browser-features",
"stylelint-scss"
],
"rules": {
"plugin/no-unsupported-browser-features": [true, {
"severity": "warning",
"ignore": "css-sel2"
}],
"at-rule-no-unknown": null,
"scss/at-each-key-value-single-line": [true],
"scss/at-extend-no-missing-placeholder": [true],
"scss/at-if-no-null": [true],
"scss/at-import-no-partial-leading-underscore": [true],
"scss/at-rule-no-unknown": [true]
}
}
9 changes: 8 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,17 @@
},
"autoload": {
"psr-4": {
"Crdm\\": "src/php/Crdm/"
"CrdmBasic\\": "src/php/CrdmBasic/"
}
},
"config": {
"classmap-authoritative": true
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.4",
"phpcompatibility/phpcompatibility-wp": "^2.1",
"wp-coding-standards/wpcs": "^2.1",
"phpmd/phpmd": "^2.7",
"phan/phan": "^2.2"
}
}
Loading

0 comments on commit cfb195e

Please sign in to comment.