@webdevstudios/prettier-config-coding-standards
Advanced tools
Comparing version
33
index.js
@@ -1,15 +0,30 @@ | ||
/* eslint-disable */ | ||
function tryAndRequire( module ) { | ||
/** | ||
* Try and require module override data. | ||
* | ||
* @author Aubrey Portwood <aubrey@webdevstudios.com> | ||
* @since 1.0.1 | ||
* @param {string} module Module. | ||
* @return {Object} Config object. | ||
*/ | ||
function loadOverrideFromModule( module ) { | ||
try { | ||
require( module ); | ||
return { | ||
...require( module ).overrides[ 0 ], | ||
}; | ||
} catch ( error ) { | ||
// Fail gracefully. | ||
return { | ||
...{ | ||
files: '', | ||
options: {}, | ||
}, | ||
}; | ||
} | ||
} | ||
module.export = { | ||
...tryAndRequire( '@webdevstudios/prettier-config-js-coding-standards' ), | ||
...tryAndRequire( '@webdevstudios/prettier-config-php-coding-standards' ), | ||
...tryAndRequire( '@webdevstudios/prettier-config-css-coding-standards' ), | ||
module.exports = { | ||
overrides: [ | ||
loadOverrideFromModule( '@webdevstudios/prettier-config-js-coding-standards' ), | ||
loadOverrideFromModule( '@webdevstudios/prettier-config-php-coding-standards' ), | ||
loadOverrideFromModule( '@webdevstudios/prettier-config-css-coding-standards' ), | ||
], | ||
}; |
{ | ||
"name": "@webdevstudios/prettier-config-coding-standards", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Dynamic Configuration Loader for WebDevStudios JavaScript, PHP, and CSS Coding Standards. ", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -13,8 +13,16 @@ <a href="https://webdevstudios.com/contact/"><img src="https://webdevstudios.com/wp-content/uploads/2018/04/wds-github-banner.png" alt="WebDevStudios. WordPress for big brands."></a> | ||
Install [`webdevstudios/css-coding-standards`](https://github.com/WebDevStudios/css-coding-standards), [`webdevstudios/js-coding-standards`](https://github.com/WebDevStudios/js-coding-standards), or [`webdevstudios/php-coding-standards`](https://github.com/WebDevStudios/php-coding-standards) and this package will be included automatically. | ||
Install [`@webdevstudios/css-coding-standards`](https://github.com/WebDevStudios/css-coding-standards), [`@webdevstudios/js-coding-standards`](https://github.com/WebDevStudios/js-coding-standards), or [`webdevstudios/php-coding-standards`](https://github.com/WebDevStudios/php-coding-standards) and this package will be included automatically. | ||
## Changelog | ||
### 1.0.1 | ||
- Patch to fix issue where the final config for `prettier` set to `@webdevstudios/prettier-config-coding-standards` combines JS, CSS, and PHP properly | ||
In the previous version these were not getting combined properly, instead the last config to load (via `npm`) would take the cake, and be the final config. This worked fine when JS was the only config, but if you installed PHP or CSS configs, they could likely end up being the final config breaking auto-formatting. | ||
This new method takes the `@webdevstudios/prettier-config-(php|js|css)-coding-standards` modules and, depending on if they are installed, takes the `overrides` setting in each and merges them into `modules.exports` for `@webdevstudios/prettier-config-coding-standards`. | ||
### 1.0.0 | ||
This version simply loads prettier configurations for [css](https://github.com/WebDevStudios/prettier-config-css-coding-standards), [js](https://github.com/WebDevStudios/prettier-config-js-coding-standards), and/or [php](https://github.com/WebDevStudios/prettier-config-php-coding-standards) if they are installed. |
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
3693
3.79%29
61.11%28
40%3
-40%1
Infinity%