Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@automattic/eslint-plugin-wpvip
Advanced tools
This is an ESLint plugin to provide WordPress VIP's (internal) JavaScript and TypeScript coding standards. It extends @wordpress/eslint-plugin
.
Install eslint
and @automattic/eslint-plugin-wpvip
to your project.
npm install --save-dev eslint @automattic/eslint-plugin-wpvip
Create an .eslintrc.js
file with your desired configs. Note: The init
file allows you to avoid installing peer dependencies (available from v0.5.0
).
require( '@automattic/eslint-plugin-wpvip/init' );
module.exports = {
extends: [
'plugin:@automattic/wpvip/base',
]
}
And that's it! Code editors that are configured to work with ESLint will automatically pick up the rules and flag any errors or warnings.
Tip: Set up a lint
npm script in package.json
:
"scripts": {
"lint": "eslint ."
}
You may also wish to define an .eslintignore
file if there are files or paths that you do not want to lint.
TypeScript rules are automatically added whenever your project has installed the typescript
NPM package as a dependency.
Prettier integration with ESLint is automatically enabled. Further, by default, this plugin provides the WordPress prettier config. You can define your own .prettierrc
configuration file, which will be merged with the default. The following .prettierrc
will use spaces for indentation instead of tabs:
{
"useTabs": false
}
If you wish to disable the automatic Prettier integration, add the prettier-off
config to your .eslintrc.js
:
{
"extends": [
"plugin:@automattic/wpvip/base",
"plugin:@automattic/wpvip/prettier-off"
]
}
The cli
config allows certain behaviors that are usually against best practice but are useful in a codebase that produces a CLI tool:
{
"extends": [
"plugin:@automattic/wpvip/base",
"plugin:@automattic/wpvip/cli"
]
}
If your project is not a CLI tool but calls console
or process
methods occasionally, don't use this config—just add ignore statements in those few spots.
The base
config includes rules related to enforce JSDoc best practices, but they are not triggered if your code does not provide @param
or @return
markers:
/**
* No rules are triggered for this docblock, because there are no param or
* return markers
*/
function myFunc1() {}
/**
* Rules *are* triggered for this docblock.
*
* @param myArg
*/
function myFunc2(myArg) {}
If you want to enforce the use of JSDoc, use the jsdoc
config:
{
"extends": [
"plugin:@automattic/wpvip/base",
"plugin:@automattic/wpvip/jsdoc"
]
}
This plugin provides a few "weak" configs for legacy codebases that are working to transition to stronger standards. These configs downgrade select rules from the base
config to warnings. Warnings will still be visible in code editors, but will not fail continous integration workflows.
These configs are intended for temporary use and should not be used long-term. We also do not recommend the use of tools like eslines to ignore errors or warnings. While the intention is to prevent large-scale changes and transition slowly to stronger standards, the effect is usually that the transition stalls and stops completely.
Two "weak" configs are available: weak
and weak-typescript
. While pull requests on this project are always welcome, please carefully consider whether adding rules to these configs is truly necessary.
FAQs
ESLint plugin for internal WordPress VIP projects
The npm package @automattic/eslint-plugin-wpvip receives a total of 1,219 weekly downloads. As such, @automattic/eslint-plugin-wpvip popularity was classified as popular.
We found that @automattic/eslint-plugin-wpvip demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.