Skip to content

Commit

Permalink
added prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
nk-o committed Feb 11, 2022
1 parent a7da738 commit 781b44a
Show file tree
Hide file tree
Showing 119 changed files with 12,073 additions and 14,554 deletions.
10 changes: 8 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space

[*.php]
indent_size = 4

[*.md]
trim_trailing_whitespace = false
29 changes: 14 additions & 15 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@

{
"extends": [
"eslint-config-nk"
],
"globals": {
"wp": true
},
"settings": {
"react": {
"pragma": "wp"
}
},
"rules": {
"react/prefer-stateless-function": "off",
"react/prop-types": "off"
"extends": [
"eslint-config-nk"
],
"globals": {
"wp": true
},
"settings": {
"react": {
"pragma": "wp"
}
},
"rules": {
"react/prefer-stateless-function": "off",
"react/prop-types": "off"
}
}
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
**/*.css
**/*.scss
**/*.html
**/*.php
node_modules
dist
vendor
vendors
1 change: 1 addition & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('prettier-config-nk');
1 change: 1 addition & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
**/*.min.css
**/*.build.css
node_modules
dist
vendor
vendors
5 changes: 0 additions & 5 deletions .stylelintrc

This file was deleted.

3 changes: 3 additions & 0 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['stylelint-config-nk'],
};
10 changes: 10 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"recommendations": [
"esbenp.prettier-vscode",
"streetsidesoftware.code-spell-checker",
"editorconfig.editorconfig",
"dbaeumer.vscode-eslint",
"stylelint.vscode-stylelint",
"bmewburn.vscode-intelephense-client"
]
}
29 changes: 29 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"editor.defaultFormatter": null,
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[php]": {
"editor.defaultFormatter": null
},
"editor.formatOnSave": true,

"scss.validate": false,
"css.validate": false,
"less.validate": false,

"editor.codeActionsOnSave": {
"source.fixAll.stylelint": true
},
"stylelint.validate": [
"css",
"scss"
],
"stylelint.snippet": [
"css",
"scss"
],
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
17 changes: 9 additions & 8 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
module.exports = {
presets: [
'@babel/preset-env',
],
plugins: [
[ '@babel/plugin-transform-react-jsx', {
pragma: 'wp.element.createElement',
} ],
[ '@babel/plugin-proposal-object-rest-spread' ],
presets: ['@babel/preset-env'],
plugins: [
[
'@babel/plugin-transform-react-jsx',
{
pragma: 'wp.element.createElement',
},
],
['@babel/plugin-proposal-object-rest-spread'],
],
};
22 changes: 11 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"require-dev": {
"wp-coding-standards/wpcs": "^2.3.0",
"phpcompatibility/phpcompatibility-wp": "^2.1.2",
"wp-cli/i18n-command": "^2.2.9",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1"
},
"scripts": {
"phpcs": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs",
"phpcbf": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf",
"wp": "\"vendor/wp-cli/wp-cli/bin/wp\""
}
"require-dev": {
"wp-coding-standards/wpcs": "^2.3.0",
"phpcompatibility/phpcompatibility-wp": "^2.1.2",
"wp-cli/i18n-command": "^2.2.9",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1"
},
"scripts": {
"phpcs": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs",
"phpcbf": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf",
"wp": "\"vendor/wp-cli/wp-cli/bin/wp\""
}
}
26 changes: 13 additions & 13 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
// eslint-disable-next-line import/no-extraneous-dependencies
const micromatch = require( 'micromatch' );
const micromatch = require('micromatch');

function excludeVendor( lint ) {
return ( filenames ) => {
const files = micromatch( filenames, '!**/vendor/**/*' );
function excludeVendor(lint) {
return (filenames) => {
const files = micromatch(filenames, '!**/vendor/**/*');

if ( files && files.length ) {
return `${ lint } ${ files.join( ' ' ) }`;
}
if (files && files.length) {
return `${lint} ${files.join(' ')}`;
}

return [];
};
return [];
};
}

module.exports = {
'src/**/*.php': excludeVendor( 'composer run-script phpcs' ),
'src/**/*.css': excludeVendor( 'stylelint' ),
'src/**/*.scss': excludeVendor( 'stylelint --syntax scss' ),
'src/**/*.{js,jsx}': excludeVendor( 'eslint' ),
'src/**/*.php': excludeVendor('composer run-script phpcs'),
'src/**/*.css': excludeVendor('stylelint'),
'src/**/*.scss': excludeVendor('stylelint --custom-syntax postcss-scss'),
'src/**/*.{js,jsx}': excludeVendor('eslint'),
};
Loading

0 comments on commit 781b44a

Please sign in to comment.