-
Notifications
You must be signed in to change notification settings - Fork 703
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quality of Life Improvements for Development #1043
Conversation
"singleQuote": true, | ||
"printWidth": 100, | ||
"endOfLine": "lf", | ||
"trailingComma": "all" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yas trailing commas 👍
Sneak peak: PR feedback (coming up later, not for now) Warnings❗ Big PR (1) Markdowns
New dependencies added:
|
Created | over 1 year ago |
Last Updated | 15 days ago |
License | MIT |
Maintainers | 3 |
Releases | 43 |
Direct Dependencies | @commitlint/format , @commitlint/lint , @commitlint/load , @commitlint/read , babel-polyfill , chalk , get-stdin , lodash.merge , lodash.pick , meow , resolve-from and resolve-global |
Keywords | conventional-changelog, commitlint and cli |
README
Lint commit messages
@commitlint/cli
Getting started
npm install --save-dev @commitlint/cli @commitlint/config-angular
echo "module.exports = {extends: ['@commitlint/config-angular']};" > commitlint.config.js
Consult docs/cli for comprehensive documentation.
@commitlint/config-conventional
Author: Mario Nebl
Description: Shareable commitlint config enforcing conventional commits
Homepage: https://github.com/marionebl/commitlint#readme
Created | 12 months ago |
Last Updated | 15 days ago |
License | MIT |
Maintainers | 3 |
Releases | 16 |
Keywords | conventional-changelog, commitlint, commitlint-config and angular |
README
Lint your conventional commits
@commitlint/config-conventional
Shareable commitlint
config enforcing conventional commits.
Use with @commitlint/cli and @commitlint/prompt-cli.
IMPORTANT | This is a direct replacement for @commitlint/config-angular prior to version 4. config-angular diverged from the conventional commit convention as of version 5. See #146 for details. |
Getting started
npm install --save-dev @commitlint/config-conventional @commitlint/cli
echo "module.exports = {extends: ['@commitlint/config-conventional']};" > commitlint.config.js
Rules
Problems
The following rules are considered problems for @commitlint/config-conventional
and will yield a non-zero exit code when not met.
Consult docs/rules for a list of available rules.
type-enum
-
condition:
type
is found in value -
rule:
always
-
value
[ 'build', 'ci', 'chore', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'style', 'test' ]
echo "foo: some message" # fails
echo "fix: some message" # passes
type-case
- description:
type
is in casevalue
- rule:
always
- value
'lowerCase'
echo "FIX: some message" # fails
echo "fix: some message" # passes
type-empty
- condition:
type
is empty - rule:
never
echo ": some message" # fails
echo "fix: some message" # passes
scope-case
- condition:
scope
is in casevalue
- rule:
always
'lowerCase'
echo "fix(SCOPE): some message" # fails
echo "fix(scope): some message" # passes
subject-case
- condition:
subject
is in one of the cases['sentence-case', 'start-case', 'pascal-case', 'upper-case']
- rule:
never
echo "fix(SCOPE): Some message" # fails
echo "fix(SCOPE): Some Message" # fails
echo "fix(SCOPE): SomeMessage" # fails
echo "fix(SCOPE): SOMEMESSAGE" # fails
echo "fix(scope): some message" # passes
echo "fix(scope): some Message" # passes
subject-empty
- condition:
subject
is empty - rule:
never
echo "fix:" # fails
echo "fix: some message" # passes
subject-full-stop
- condition:
subject
ends withvalue
- rule:
never
- value
'.'
echo "fix: some message." # fails
echo "fix: some message" # passes
header-max-length
- condition:
header
hasvalue
or less characters - rule:
always
- value
72
echo "fix: some message that is way too long and breaks the line max-length by several characters" # fails
echo "fix: some message" # passes
@commitlint/prompt
Author: Mario Nebl
Description: commitizen prompt using commitlint.config.js
Homepage: https://github.com/marionebl/commitlint#readme
Created | over 1 year ago |
Last Updated | 15 days ago |
License | MIT |
Maintainers | 3 |
Releases | 41 |
Direct Dependencies | @commitlint/load , babel-runtime , chalk , lodash.camelcase , lodash.kebabcase , lodash.snakecase , lodash.startcase , lodash.topairs , lodash.upperfirst , throat and vorpal |
Keywords | conventional-changelog, commitlint, prompt, cz and commitizen |
README
commitizen adapter using commitlint.config.js
@commitlint/prompt
This is the library and commitizen adapter version of commitlint prompt.
A ready-to-use cli version is available at @commitlint/prompt-cli.
Learn how to use it at docs/prompt.
Getting started
npm install --save-dev @commitlint/prompt @commitlint/config-angular commitizen
echo "module.exports = {extends: ['@commitlint/config-conventional']};" > commitlint.config.js
In package.json
{
"scripts": {
"commit": "git-cz"
},
"config": {
"commitizen": {
"path": "@commitlint/prompt"
}
}
}
git add .
npm run commit
@commitlint/prompt-cli
Author: Mario Nebl
Description: commit prompt using commitlint.config.js
Homepage: https://github.com/marionebl/commitlint#readme
Created | over 1 year ago |
Last Updated | 15 days ago |
License | MIT |
Maintainers | 3 |
Releases | 41 |
Direct Dependencies | @commitlint/prompt , execa and meow |
Keywords | commitlint and prompt |
README
commit prompt using commitlint.config.js
@commitlint/prompt-cli
Getting started
npm install --g @commitlint/prompt-cli @commitlint/config-angular
echo "module.exports = {extends: ['@commitlint/config-angular']};" > commitlint.config.js
git add .
commit
A full usage guide is available at docs/prompt.
commitizen
Author: Jim Cummins
Description: Git commit, but play nice with conventions.
Homepage: https://github.com/commitizen/cz-cli
Created | over 3 years ago |
Last Updated | 17 days ago |
License | MIT |
Maintainers | 5 |
Releases | 54 |
Direct Dependencies | cachedir , cz-conventional-changelog , dedent , detect-indent , find-node-modules , find-root , fs-extra , glob , inquirer , lodash , minimist , shelljs and strip-json-comments |
Keywords | commit, pretty, format, conventional changelog and commitizen |
cross-spawn
Author: André Cruz
Description: Cross platform child_process#spawn and child_process#spawnSync
Homepage: https://github.com/moxystudio/node-cross-spawn
Created | over 4 years ago |
Last Updated | 7 months ago |
License | MIT |
Maintainers | 1 |
Releases | 50 |
Direct Dependencies | nice-try , path-key , semver , shebang-command and which |
Keywords | spawn, spawnSync, windows, cross-platform, path-ext, shebang, cmd and execute |
README
cross-spawn
A cross platform solution to node's spawn and spawnSync.
Installation
$ npm install cross-spawn
Why
Node has issues when using spawn on Windows:
- It ignores PATHEXT
- It does not support shebangs
- Has problems running commands with spaces
- Has problems running commands with posix relative paths (e.g.:
./my-folder/my-executable
) - Has an issue with command shims (files in
node_modules/.bin/
), where arguments with quotes and parenthesis would result in invalid syntax error - No
options.shell
support on node<v4.8
All these issues are handled correctly by cross-spawn
.
There are some known modules, such as win-spawn, that try to solve this but they are either broken or provide faulty escaping of shell arguments.
Usage
Exactly the same way as node's spawn
or spawnSync
, so it's a drop in replacement.
const spawn = require('cross-spawn');
// Spawn NPM asynchronously
const child = spawn('npm', ['list', '-g', '-depth', '0'], { stdio: 'inherit' });
// Spawn NPM synchronously
const result = spawn.sync('npm', ['list', '-g', '-depth', '0'], { stdio: 'inherit' });
Caveats
Using options.shell
as an alternative to cross-spawn
Starting from node v4.8
, spawn
has a shell
option that allows you run commands from within a shell. This new option solves
the PATHEXT issue but:
- It's not supported in node
<v4.8
- You must manually escape the command and arguments which is very error prone, specially when passing user input
- There are a lot of other unresolved issues from the Why section that you must take into account
If you are using the shell
option to spawn a command in a cross platform way, consider using cross-spawn
instead. You have been warned.
options.shell
support
While cross-spawn
adds support for options.shell
in node <v4.8
, all of its enhancements are disabled.
This mimics the Node.js behavior. More specifically, the command and its arguments will not be automatically escaped nor shebang support will be offered. This is by design because if you are using options.shell
you are probably targeting a specific platform anyway and you don't want things to get into your way.
Shebangs support
While cross-spawn
handles shebangs on Windows, its support is limited. More specifically, it just supports #!/usr/bin/env <program>
where <program>
must not contain any arguments.
If you would like to have the shebang support improved, feel free to contribute via a pull-request.
Remember to always test your code on Windows!
Tests
$ npm test
$ npm test -- --watch
during development
License
Released under the MIT License.
eslint-config-prettier
Author: Simon Lydell
Description: Turns off all rules that are unnecessary or might conflict with Prettier.
Homepage: https://github.com/prettier/eslint-config-prettier#readme
Created | almost 2 years ago |
Last Updated | 11 days ago |
License | MIT |
Maintainers | 1 |
Releases | 30 |
Direct Dependencies | get-stdin |
Keywords | eslint, eslintconfig and prettier |
eslint-import-resolver-webpack
Author: Ben Mosher
Description: Resolve paths to dependencies, given a webpack.config.js. Plugin for eslint-plugin-import.
Homepage: https://github.com/benmosher/eslint-plugin-import/tree/master/resolvers/webpack
Created | almost 3 years ago |
Last Updated | 5 months ago |
License | MIT |
Maintainers | 3 |
Releases | 29 |
Direct Dependencies | array-find , debug , enhanced-resolve , find-root , has , interpret , lodash , node-libs-browser , resolve and semver |
Keywords | eslint-plugin-import, eslint, jsnext, modules and webpack |
README
eslint-import-resolver-webpack
Webpack-literate module resolution plugin for eslint-plugin-import
.
Published separately to allow pegging to a specific version in case of breaking
changes.
To use with eslint-plugin-import
, run:
npm i eslint-import-resolver-webpack -g
or if you manage ESLint as a dev dependency:
# inside your project's working tree
npm install eslint-import-resolver-webpack --save-dev
Will look for webpack.config.js
as a sibling of the first ancestral package.json
,
or a config
parameter may be provided with another filename/path either relative to the
package.json
, or a complete, absolute path.
If multiple webpack configurations are found the first configuration containing a resolve section will be used. Optionally, the config-index
(zero-based) setting can be used to select a specific configuration.
---
settings:
import/resolver: webpack # take all defaults
or with explicit config file name:
---
settings:
import/resolver:
webpack:
config: 'webpack.dev.config.js'
or with explicit config file name:
---
settings:
import/resolver:
webpack:
config: 'webpack.multiple.config.js'
config-index: 1 # take the config at index 1
or with explicit config object:
---
settings:
import/resolver:
webpack:
config:
resolve:
extensions:
- .js
- .jsx
husky
Author: Typicode
Description: Prevents bad commit or push (git hooks, pre-commit/precommit, pre-push/prepush, post-merge/postmerge and all that stuff...)
Homepage: https://github.com/typicode/husky#readme
Created | over 4 years ago |
Last Updated | 2 days ago |
License | MIT |
Maintainers | 1 |
Releases | 106 |
Direct Dependencies | cosmiconfig , execa , find-up , get-stdin , is-ci , pkg-dir , please-upgrade-node , read-pkg , run-node and slash |
Keywords | git, hook, hooks, pre-commit, precommit, post-commit, postcommit, pre-push, prepush, post-merge, postmerge, test and lint |
README
husky
Git hooks made easy
Husky can prevent bad git commit
, git push
and more 🐶 woof!
Support
Do you ❤️ husky? You can support its development on Patreon!
Install
npm install husky --save-dev
// package.json
{
"husky": {
"hooks": {
"pre-commit": "npm test",
"pre-push": "npm test",
"...": "..."
}
}
}
git commit -m 'Keep calm and commit'
To go further, see the docs here.
Uninstall
npm uninstall husky
Upgrading from 0.14
Simply move your existing hooks to husky.hooks
field and use raw Git hooks names. Also, if you're using the GIT_PARAMS
env variable, rename it to HUSKY_GIT_PARAMS
.
{
"scripts": {
- "precommit": "npm test",
- "commitmsg": "commitlint -E GIT_PARAMS"
},
+ "husky": {
+ "hooks": {
+ "pre-commit": "npm test",
+ "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
+ }
+ }
}
Alternatively, you can run the following command which will do the same automatically for you ;)
./node_modules/.bin/husky-upgrade
Starting with 1.0.0
, you can also configure hooks using .huskyrc
, .huskyrc.json
or .huskyrc.js
file.
// .huskyrc
{
"hooks": {
"pre-commit": "npm test"
}
}
To view the full list of changes, please see the CHANGELOG.
Features
- Keeps existing user hooks
- Supports GUI Git clients
- Supports all Git hooks (
pre-commit
,pre-push
, ...)
Used by
- jQuery
- babel
- create-react-app
- Next.js
- Hyper
- Kibana
- JSON Server
- Hotel
- ... and 28k+ other awesome repos
See also
- pkg-ok - Prevents publishing a module with bad paths or incorrect line endings
- please-upgrade-node - Show a message to upgrade Node instead of a stacktrace in your CLIs
- pinst - dev only postinstall hook
License
MIT
Patreon - Supporters ✨
lint-staged
Author: Andrey Okonetchnikov
Description: Lint files staged by git
Homepage: https://github.com/okonet/lint-staged#readme
Created | almost 3 years ago |
Last Updated | 1 day ago |
License | MIT |
Maintainers | 1 |
Releases | 87 |
Direct Dependencies | @iamstarkov/listr-update-renderer , chalk , commander , cosmiconfig , debug , dedent , del , execa , find-parent-dir , g-status , is-glob , is-windows , jest-validate , listr , lodash , log-symbols , micromatch , npm-which , p-map , path-is-inside , pify , please-upgrade-node , staged-git-files , string-argv and stringify-object |
Keywords | lint, git, staged, eslint, prettier, stylelint, code, quality, check, format and validate |
prettier
Author: James Long
Description: Prettier is an opinionated code formatter
Homepage: https://prettier.io
Created | almost 2 years ago |
Last Updated | 12 days ago |
License | MIT |
Maintainers | 6 |
Releases | 79 |
README
Opinionated Code Formatter
JavaScript
· TypeScript
· Flow
· JSX
· JSON
CSS
· SCSS
· Less
HTML
· Vue
· Angular
GraphQL
· Markdown
· YAML
Your favorite language?
Intro
Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.
Input
foo(reallyLongArg(), omgSoManyParameters(), IShouldRefactorThis(), isThereSeriouslyAnotherOne());
Output
foo(
reallyLongArg(),
omgSoManyParameters(),
IShouldRefactorThis(),
isThereSeriouslyAnotherOne()
);
Prettier can be run in your editor on-save, in a pre-commit hook, or in CI environments to ensure your codebase has a consistent style without devs ever having to post a nit-picky comment on a code review ever again!
Badge
Show the world you're using Prettier →
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
Contributing
See CONTRIBUTING.md.
read-pkg-up
Author: Sindre Sorhus
Description: Read the closest package.json file
Homepage: https://github.com/sindresorhus/read-pkg-up#readme
Created | about 3 years ago |
Last Updated | 5 months ago |
License | MIT |
Maintainers | 1 |
Releases | 4 |
Direct Dependencies | find-up and read-pkg |
Keywords | json, read, parse, file, fs, graceful, load, pkg, package, find, up, find-up, findup, look-up, look, search, match, resolve, parent, parents, folder, directory, dir, walk, walking and path |
README
read-pkg-up
Read the closest package.json file
Why
- Finds the closest package.json
- Gracefully handles filesystem issues
- Strips UTF-8 BOM
- Throws more helpful JSON errors
- Normalizes the data
Install
$ npm install read-pkg-up
Usage
const readPkgUp = require('read-pkg-up');
(async () => {
console.log(await readPkgUp());
/*
{
pkg: {
name: 'awesome-package',
version: '1.0.0',
…
},
path: '/Users/sindresorhus/dev/awesome-package/package.json'
}
*/
})();
API
readPkgUp([options])
Returns a Promise
for the result object.
readPkgUp.sync([options])
Returns the result object.
options
Type: Object
cwd
Type: string
Default: process.cwd()
Directory to start looking for a package.json file.
normalize
Type: boolean
Default: true
Normalize the package data.
Related
- read-pkg - Read a package.json file
- pkg-up - Find the closest package.json file
- find-up - Find a file by walking up parent directories
- pkg-conf - Get namespaced config from the closest package.json
License
MIT © Sindre Sorhus
which
Author: Isaac Z. Schlueter
Description: Like which(1) unix command. Find the first instance of an executable in the PATH.
Homepage: https://github.com/isaacs/node-which#readme
Created | over 7 years ago |
Last Updated | 5 months ago |
License | ISC |
Maintainers | 1 |
Releases | 27 |
Direct Dependencies | isexe |
README
which
Like the unix which
utility.
Finds the first instance of a specified executable in the PATH
environment variable. Does not cache the results, so hash -r
is not
needed when the PATH changes.
USAGE
var which = require('which')
// async usage
which('node', function (er, resolvedPath) {
// er is returned if no "node" is found on the PATH
// if it is found, then the absolute path to the exec is returned
})
// sync usage
// throws if not found
var resolved = which.sync('node')
// if nothrow option is used, returns null if not found
resolved = which.sync('node', {nothrow: true})
// Pass options to override the PATH and PATHEXT environment vars.
which('node', { path: someOtherPath }, function (er, resolved) {
if (er)
throw er
console.log('found at %j', resolved)
})
CLI USAGE
Same as the BSD which(1)
binary.
usage: which [-as] program ...
OPTIONS
You may pass an options object as the second argument.
path
: Use instead of thePATH
environment variable.pathExt
: Use instead of thePATHEXT
environment variable.all
: Return all matches, instead of just the first one. Note that
this means the function returns an array of strings instead of a
single string.
Danger: ✓ found only warnings, not failing the build
❌ build failed |
2c0bd07
to
7e9c67e
Compare
144e2c8
to
7744923
Compare
7744923
to
6014187
Compare
* add opt-in quality of life improvements for development, details follow. * add `.editorconfig`. * move prettier config to `package.json`. * fix precommit script to run on WSL. * add ignore patterns to unused vars/args * preliminary work on getting eslint working (though I'm replacing it with us going full tslint instead). * replace shx commands with rimraf in `package.json`. * specify min node and yarn versions. * Since upgrade to TS was also done on a different branch this specifies a version range instead. About improvements: This is opt-in behavior, meaning it's not enabled by default, as to not hinder the team and new contributors. However, I strongly recommend everyone to do opt in. Here's how: Create a file called `.opt-in` at the root of the repository, with the options you wish to enable (one per line). - `pre-commit`: * Source code files are formatted with Prettier automatically. * Source code files are checked with TSLint and ESLint automatically. - `commit-msg`: * Commit messages are validated to follow a convention. See <https://www.conventionalcommits.org/en/v1.0.0-beta.2/> for details. Please note, if you do opt-in, that since these are new practices, not enforced before, there's a good chance you might want a workaround if you're getting warnings from unrelated areas of your current task. While we encourage you to fix as many as you can, you can always opt-out in an case by case basis by running `git commit -n`. About node versions: Make sure that developers are running a supported and tested version of Node. When Node 12 comes up, we would explicitly update this field after testing. This is better than unexpected issues resulting from people running an early release or a GA release that hasn't been tested.
6014187
to
465d7d2
Compare
This PR is an initial step towards providing general improvements for developers and contributors of SLOBS.
3.1.63.2.1). Updating selection API (which was apparently outdated) and pinning@types/jquery
(used from our deps) were the only required changes.rimraf
was already a dependency, I don't believe there's a need to useshx
anymore (we're only using it torm -rf
files). In addition, there's less typing and more clarify in our scripts section of ourpackage.json
. And yes, I've looked at Use cross-platform commands #693 😂. Still unclear to me whyrimraf
is ondependencies
instead ofdevDependencies
BTW.Opt-in
The following is opt-in behavior, meaning it's not enabled by default, as to not hinder the team and new contributors. However, I'd strongly recommend everyone to do opt in.
Here's how:
Create a file called
.opt-in
at the root of the repository, with the options you wish to enable (one per line).pre-commit
:commit-msg
:See Conventional Commits and commitlint-config-conventional for details. The benefits of a commit convention include, but not limited to, consistency in commit types (with the side-effect of shorted and more focused commits, e.g fixes vs features), automatic changelog generation, semantic versioning once we reach 1.0, etc).
Please note, if you do opt-in, that since these are new practices, not enforced before, there's a good chance you might want a workaround if something gets in your way coming from unrelated areas.
While we encourage you to fix as many as you can, you can always opt-out in an case by case basis by running
git commit -n
.Documenting this in something like a CONTRIBUTING.md is perhaps something we'd like to do at some point in the future, for visibility.