Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
import-sort-style-wes
Advanced tools
Wes' personal style for import-sort.
// Modules without members
import '@scoped/module';
import 'first-module';
import 'second-module';
import '~/local-module';
// Installed and scoped modules
import scoped from '@scoped/thing';
import whatever from 'module-a';
import anything from 'module-b';
// Local resolved modules
import exported from '~/project-root-file';
// Siblings and parents
import things from '../grand-parent';
import name from '../parent';
import sibling from './sibling';
~
?Not all characters can be used at a module path, because of npm
registry
rules, and file system constraints. npm
already uses the @
prefix to scope
organizations and teams.
Inspired by Parcel, which resolves ~
to the project
source directory by default, I decided to define ~
as the de facto reference
for all of my packages root source directories.
Some projects prefer to have every folder on the project source as its own
resolve alias. I find this bad especially for use cases like this, where one
would need to read the file system to determine if an import is within
node_modules
or the project's source folder. Given that these can be
configured in a multitude of ways, I decided to not support that at all.
These instrutions use prettier, which is my preferred method of enforcing import sort order.
# Install prettier-plugin-import-sort
yarn add -D prettier-plugin-import-sort
# Install import-sort-style-wes
yarn add -D import-sort-style-wes
Then add on your root package.json
:
{
"importSort": {
".js, .jsx": {
"parser": "babylon",
"style": "wes"
},
".ts, .tsx": {
"parser": "typescript",
"style": "wes"
}
}
}
I've used yarn, and tsdx, which provides scaffolding for TypeScript libraries.
# Install yarn, if you don't have it
curl -o- -L https://yarnpkg.com/install.sh | bash
# Install dependencies
yarn install
# Build upon changes (development mode)
yarn run dev
# Lint code
yarn run lint
# Test code
yarn run test
# Build code
yarn run build
FAQs
Wes' personal import-sort style
The npm package import-sort-style-wes receives a total of 91 weekly downloads. As such, import-sort-style-wes popularity was classified as not popular.
We found that import-sort-style-wes demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.