Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #96 from dingo-d/feature/use-namespace
Browse files Browse the repository at this point in the history
Feature/use namespace
  • Loading branch information
dingo-d authored Jan 15, 2019
2 parents a0af96a + 692e527 commit a8d57de
Show file tree
Hide file tree
Showing 65 changed files with 11,765 additions and 8,233 deletions.
16 changes: 12 additions & 4 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
{
"presets": [
["env", {
"targets": {
"browsers": ["last 2 versions", "not ie < 11", "android >= 4.2"]
[
"@babel/preset-env",
{
"targets": {
"browsers": [
"last 2 versions",
"not ie < 11",
"android >= 4.2"
],
"node": "current"
}
}
}]
]
]
}
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab
indent_size = 4

[*.md]
trim_trailing_whitespace = false
File renamed without changes.
14 changes: 6 additions & 8 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@
"__VERSION__": true
},
"env": {

# You can change environment depending on the project you are working on
"browser": true,
"node": true,
"commonjs": true,
"es6": true,
"jquery": true
},
extends: ["eslint:recommended", "wordpress"],
rules: {
indent: ["error", "tab"],
"extends": ["eslint:recommended", "wordpress"],
"rules": {
"indent": ["error", "tab"],
"linebreak-style": ["error", "unix"],
quotes: ["error", "single"],
semi: ["error", "always"],
yoda: ["error", "never"]
"quotes": ["error", "single"],
"semi": ["error", "always"],
"yoda": ["error", "never"]
}
}
11 changes: 9 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@
node_modules/
vendor/

# Project build folder
/build/
/assets/build/

# Mac OS custom attribute store and thumbnails
*.DS_Store
._*

# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db

# Build assets
assets/build/
# IDE specific
theme-sniffer.sublime-project
theme-sniffer.sublime-workspace
115 changes: 1 addition & 114 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -1,116 +1,3 @@
{
"ignoreFiles": "public/**/*.css",
"rules": {
"color-hex-case": "upper",
"color-hex-length": "long",
"color-named": "never",
"color-no-invalid-hex": true,

"font-family-name-quotes": "always-unless-keyword",

"font-weight-notation": "named-where-possible",

"function-calc-no-unspaced-operator": true,
"function-comma-space-after": "always",
"function-comma-space-before": "never",
"function-linear-gradient-no-nonstandard-direction": true,
"function-parentheses-newline-inside": "never-multi-line",
"function-parentheses-space-inside": "never",
"function-url-quotes": "always",
"function-whitespace-after": "always",

"number-leading-zero": "always",
"number-max-precision": 2,
"number-no-trailing-zeros": true,
"length-zero-no-unit": true,

"string-no-newline": true,
"string-quotes": "single",

"value-no-vendor-prefix": true,
"value-list-comma-newline-before": "never-multi-line",
"value-list-comma-space-after": "always-single-line",
"value-list-comma-space-before": "never",

"property-no-vendor-prefix": true,

"declaration-bang-space-after": "never",
"declaration-bang-space-before": "always",
"declaration-colon-space-after": "always-single-line",
"declaration-colon-space-before": "never",
"declaration-no-important": true,

"declaration-block-no-duplicate-properties": true,
"declaration-block-no-shorthand-property-overrides": true,
"declaration-block-semicolon-newline-after": "always",
"declaration-block-semicolon-newline-before": "never-multi-line",
"declaration-block-semicolon-space-after": "always-single-line",
"declaration-block-semicolon-space-before": "never",
"declaration-block-single-line-max-declarations": 1,
"declaration-block-trailing-semicolon": "always",

"block-closing-brace-newline-after": "always",
"block-closing-brace-newline-before": "always",
"block-no-empty": true,
"block-opening-brace-newline-after": "always",
"block-opening-brace-newline-before": "always-single-line",

"selector-combinator-space-after": "always",
"selector-combinator-space-before": "always",
"selector-max-specificity": "0,4,0",
"selector-max-id": 0,
"selector-max-type": 4,
"selector-max-universal": 0,
"selector-no-vendor-prefix": true,
"selector-pseudo-element-colon-notation": "double",

"selector-list-comma-newline-after": "always",
"selector-list-comma-newline-before": "never-multi-line",

"rule-empty-line-before": [
"always", {
"except": [
"first-nested"
],
"ignore": [
"after-comment"
]
}
],

"media-feature-colon-space-after": "always",
"media-feature-colon-space-before": "never",
"media-feature-name-no-vendor-prefix": true,
"media-feature-range-operator-space-after": "always",
"media-feature-range-operator-space-before": "always",

"at-rule-empty-line-before": [
"always", {
"except": [
"first-nested",
"blockless-after-blockless"
],
"ignore": [
"after-comment"
]
}
],
"at-rule-no-vendor-prefix": true,

"comment-empty-line-before": [
"always", {
"ignore": [
"after-comment"
]
}
],
"comment-whitespace-inside": "always",

"indentation": 2,
"max-line-length": 250,
"max-nesting-depth": 5,
"no-duplicate-selectors": true,
"no-eol-whitespace": true,
"no-unknown-animations": true
}
"extends": "stylelint-config-wordpress"
}
70 changes: 44 additions & 26 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
sudo: false

dist: trusty

cache:
apt: true
directories:
# Cache directory for older Composer versions.
- $HOME/.composer/cache/files
# Cache directory for more recent Composer versions.
- $HOME/.cache/composer/files

language: php

before_install:
- phpenv config-rm xdebug.ini
php:
- 5.6
- 7.0
- 7.1
- 7.3
- nightly

env:
# Highest supported PHPCS version.
- PHPCS_BRANCH="dev-master" LINT=1
# Lowest supported PHPCS version.
- PHPCS_BRANCH="3.3.0"

notifications:
email:
Expand All @@ -15,32 +34,31 @@ branches:
only:
- master

cache:
apt: true
directories:
- node_modules
- vendor
- composer
- $HOME/.composer/cache

matrix:
fast_finish: true
include:
- php: 5.3
dist: precise
env: WP_VERSION=3.7.22 WP_MULTISITE=0
- php: 5.6
env: WP_VERSION=latest WP_MULTISITE=1
- php: 7.1
env: WP_VERSION=latest WP_MULTISITE=0 SNIFF=1

before_script:
- if [[ "$SNIFF" == "1" ]]; then export PATH="$HOME/.composer/vendor/bin:$PATH"; fi
- if [[ "$SNIFF" == "1" ]]; then composer global require wp-coding-standards/wpcs; fi
- if [[ "$SNIFF" == "1" ]]; then phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs; fi
# Seperate builds for PHP 7.2 with additional checks.
- php: 7.2
env: PHPCS_BRANCH="dev-master" LINT=1 SNIFF=1
addons:
apt:
packages:
- libxml2-utils
- php: 7.2
env: PHPCS_BRANCH="3.3.0"

allow_failures:
# Allow failures for unstable builds.
- php: nightly
- php: 7.3
env: PHPCS_BRANCH="3.3.0"

before_install:
- phpenv config-rm xdebug.ini
- composer require squizlabs/php_codesniffer:${PHPCS_BRANCH} --no-update --no-suggest --no-scripts

script:
# Search theme for PHP syntax errors.
- find . \( -name '*.php' \) -exec php -lf {} \;
- if [[ "$SNIFF" == "1" ]]; then phpcs --standard=phpcs.ruleset.xml $(find . -name '*.php'); fi
- if [[ "$SNIFF" == "1" ]]; then phpcs --standard=phpcs.ruleset.xml $(find . -name '*.php'); fi
# Lint the PHP files against parse errors.
- if [[ "$LINT" == "1" ]]; then if find . -path ./vendor -prune -o -name "*.php" -exec php -l {} \; | grep "^[Parse error|Fatal error]"; then exit 1; fi; fi
# Check the codestyle of the WPThemeReview codebase.
- if [[ "$SNIFF" == "1" ]]; then $(pwd)/vendor/bin/phpcs; fi
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 WordPress Theme Review Team and contributors.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
29 changes: 22 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
# Theme Sniffer

Theme Sniffer plugin using sniffs. `WordPress-Theme` standard is used from [WPTRT/WordPress-Coding-Standards](https://github.com/WPTRT/WordPress-Coding-Standards).
* [Description](#description)
* [Requirements](#requirements)
* [Installation](#installation)
* [Contributing](#contributing)
* [License](#license)

![Screenshot](screenshot.png?raw=true)
## Description

Theme Sniffer will help you analyze your theme code, ensuring the PHP and WordPress Coding Standards compatibility.

## Requirements

The Theme Sniffer requires:

## Installing
* PHP 5.6 or higher.
* WordPress 4.7 or higher.

### Option 1: Easy
## Installation

* Download [zip file](https://github.com/WPTRT/theme-sniffer/releases/download/0.1.5/theme-sniffer.0.1.5.zip). [Note: Please use this distribution plugin zip. GitHub provided zip will not work.]
### For themes development

* Download [zip file](https://github.com/WPTRT/theme-sniffer/releases/download/0.2.0/theme-sniffer.0.2.0.zip). [Note: Please use this distribution plugin zip. GitHub provided zip will not work.]
* Install this as you normally install a WordPress plugin
* Activate plugin

### Option 2: Nerdy
### For Theme Sniffer development

* Clone this repo under `wp-content/plugins/`
* Run `composer install`
Expand All @@ -22,7 +35,9 @@ Theme Sniffer plugin using sniffs. `WordPress-Theme` standard is used from [WPTR

__Note__: If you build the plugin this way you'll have extra `node_modules/` and `vendor/` folders which are not required for the plugin to run, and just take up space. They are to be used for the development purposes mainly.

## Using
![Screenshot](screenshot.png?raw=true)

## Usage

* Go to `Appearance` -> `Theme Sniffer`
* Select theme from the dropdown
Expand Down
2 changes: 1 addition & 1 deletion assets/dev/application.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Load Styles
import './styles/admin.css';
import './styles/application.scss';

// Load Scripts
import './scripts/index';
Loading

0 comments on commit a8d57de

Please sign in to comment.