
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@element-public/prettier-config
Advanced tools
A mostly reasonable shared `prettier` configuration for Element
A mostly reasonable shared prettier
configuration for Element
npm i --save-dev @element/prettier-config
prettier
Adoption of this common config for prettier
can be achieved two ways:
element-prettier
by adding module reference to prettier
in
package.json
element-prettier
by importing into local .prettierrc.js
prettier
config fileLearn more about
shared prettier
configurations
on the prettier
website.
element-prettier
configSharing a Prettier configuration is simple: just publish a module that exports a configuration object, say
@element/prettier-config
, and reference it in yourpackage.json
:
{
"name": "my-cool-library",
"version": "9000.0.1",
"prettier": "@element/prettier-config/.prettierrc.json"
}
Note: This method does not offer a way to extend the configuration to overwrite some properties from the shared configuration.
element-prettier
configIf you need to [extend the configuration], import the file in a
.prettierrc.js
file and export the modifications, e.g:
module.exports = {
...require('@element/prettier-config'),
semi: false
};
Note: see an example of extending prettier
config in this very repo!
package.json
scriptsA prettier
"check" can be a handy quality-assurance step added to tests
.
Likewise a prettier
"write" can become part of an automated lint
fix
process.
"scripts": {
"prettier:check": "prettier --check '**/*'",
"prettier:write": "prettier --write '**/*'",
"lint": "npm run prettier:write",
"test": "npm run prettier:check"
}
To have prettier
ignore files include a .prettierignore
file in the root of
the repo and use ignore
file syntax like with .gitignore
. An example file is
included with the @element/prettier-config
bundle hosted on npm
and can be
copied as a good starting place.
Note: there is currently no good way to extend "ignore file" patterns with
prettier
or the ignore
file pattern type syntax.
Prettier is an opinionated code formatter.
It is generally accepted that having a common style guide is valuable for a project and team but getting there is a very painful and unrewarding process. People get very emotional around particular ways of writing code and nobody likes spending time writing and receiving nits.
What usually happens once people are using Prettier is that they realize that they actually spend a lot of time and mental energy formatting their code. With Prettier editor integration, you can just press that magic key binding and poof, the code is formatted.
Prettier is great at handling "formatting rules". It is incapable of catching or
correcting "code-quality rules", which is why prettier
is used along side
various code linters for total code-style enforcement.
The Prettier website has information on editor integration as well as directions for how to use the prettier CLI.
FAQs
A mostly reasonable shared `prettier` configuration for Element
We found that @element-public/prettier-config demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.