wavevision / coding-standard
The Wavevision PHP coding standard.
Installs: 3 490
Dependents: 14
Suggesters: 0
Security: 0
Stars: 5
Watchers: 3
Forks: 1
Open Issues: 10
Language:JavaScript
Requires
- php: >=7.4
- php-parallel-lint/php-parallel-lint: ^1.2
- phpstan/phpstan: ^0.12
- slevomat/coding-standard: ^6.4
- dev-master
- 6.0.2
- 6.0.1
- 6.0.0
- 5.2.3
- 5.2.2
- 5.2.1
- 5.2.0
- 5.1.0
- 5.0.0
- 4.0.1
- 4.0.0
- 3.1.3
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.1.7
- 2.1.6
- 2.1.5
- 2.1.4
- 2.1.3
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0.0
- 1.2.0
- 1.1.11
- 1.1.10
- v1.1.9
- 1.1.8
- 1.1.7
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- dev-dependabot/npm_and_yarn/json5-1.0.2
- dev-dependabot/npm_and_yarn/qs-6.5.3
- dev-dependabot/npm_and_yarn/decode-uri-component-0.2.2
- dev-dependabot/npm_and_yarn/shell-quote-1.7.3
- dev-dependabot/npm_and_yarn/minimist-1.2.6
- dev-dependabot/npm_and_yarn/nanoid-3.2.0
- dev-dependabot/npm_and_yarn/tmpl-1.0.5
- dev-dependabot/npm_and_yarn/path-parse-1.0.7
- dev-development
This package is auto-updated.
Last update: 2024-08-07 08:02:41 UTC
README
Coding Standard
Code style rules and presets for PHP, SCSS and TypeScript. Also contains default PhpStorm project code style.
PHP
Rules for:
Installation
Via Composer
composer require --dev wavevision/coding-standard
Setup
Add to existing ruleset
<rule ref="vendor/wavevision/coding-standard/php/ruleset.xml"/>
or use directly
vendor/bin/phpcs -p --standard=vendor/wavevision/coding-standard/php/ruleset.xml <pathToSources>
SCSS and TypeScript
Rules and presets for:
Installation
Via yarn
yarn add --dev @wavevision/coding-standard
or npm
npm install --save-dev @wavevision/coding-standard
Setup
Following config examples can be further extended and customized according to project's needs compliant with respective library docs.
babel.config.js
module.exports = { presets: [ '@wavevision/coding-standard/ts/babel', '@wavevision/coding-standard/ts/babel/react', // if project uses React ], };
.eslintrc.js
module.exports = { extends: [ '@wavevision/coding-standard/ts/eslint', '@wavevision/coding-standard/ts/eslint/react', // if project uses React '@wavevision/coding-standard/ts/eslint/jest', // if project uses Jest ].map(require.resolve), parserOptions: { project: 'tsconfig.json', tsconfigRootDir: '.', }, };
Note: The order of
extends
items is crucial for all rules to work correctly.
postcss.config.js
module.exports = require('@wavevision/coding-standard/scss/postcss');
prettier.config.js
module.exports = require('@wavevision/coding-standard/ts/prettier');
stylelint.config.js
module.exports = { extends: '@wavevision/coding-standard/scss/stylelint', };
tsconfig.json
{ "extends": "@wavevision/coding-standard/ts/tsconfig.json", "include": ["./src/**/*"] }
Polyfills
Should your project need it, import babel
polyfills consisting of core-js
and regenerator-runtime
stable versions.
import '@wavevision/coding-standard/ts/polyfills';
Note: This might add unnecessary code to your bundle. Make sure your setup needs all the polyfills, otherwise, import required features only.
This should most likely happen in your project's top-level entry point.
PhpStorm
- Set
File > Settings > Editor > CodeStyle
> Scheme toProject
- Symlink
phpstorm/style.xml
to.idea/codeStyles/Project.xml