Skip to content

Commit

Permalink
Merge pull request #389 from dhis2/alpha
Browse files Browse the repository at this point in the history
chore: release alpha
  • Loading branch information
ismay authored May 5, 2021
2 parents 254342f + eeb6399 commit 717380b
Show file tree
Hide file tree
Showing 79 changed files with 1,936 additions and 1,926 deletions.
Empty file modified .browserslistrc
100644 → 100755
Empty file.
Empty file modified .editorconfig
100644 → 100755
Empty file.
Empty file modified .eslintrc.js
100644 → 100755
Empty file.
Empty file modified .github/dependabot.yml
100644 → 100755
Empty file.
Empty file modified .github/semantic.yml
100644 → 100755
Empty file.
Empty file modified .github/stale.yml
100644 → 100755
Empty file.
Empty file modified .github/workflows/codeql-analysis.yml
100644 → 100755
Empty file.
Empty file modified .github/workflows/comment-and-close.yml
100644 → 100755
Empty file.
Empty file modified .github/workflows/dhis2-verify-node.yml
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions .gitignore
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
dist/
.d2/

# Logs
logs
Expand Down
1 change: 1 addition & 0 deletions .hooks/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .hooks/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

./bin/d2-style check commit "$1"
4 changes: 4 additions & 0 deletions .hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

./bin/d2-style check
4 changes: 4 additions & 0 deletions .hooks/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn test
12 changes: 0 additions & 12 deletions .huskyrc.js

This file was deleted.

10 changes: 10 additions & 0 deletions .ls-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ls:
src:
.dir: kebab-case
.js: kebab-case
.ts: kebab-case
.css: kebab-case
.d.ts: kebab-case

ignore:
- node_modules
Empty file modified .prettierrc.js
100644 → 100755
Empty file.
104 changes: 103 additions & 1 deletion CHANGELOG.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,10 +1,112 @@
# [7.3.0](https://github.com/dhis2/cli-style/compare/v7.2.3...v7.3.0) (2020-12-16)
# [8.0.0-alpha.10](https://github.com/dhis2/cli-style/compare/v8.0.0-alpha.9...v8.0.0-alpha.10) (2021-04-22)


### Bug Fixes

* ignore .d2 directory ([#386](https://github.com/dhis2/cli-style/issues/386)) ([6a473f2](https://github.com/dhis2/cli-style/commit/6a473f262503f2816e334d7a2042ea3fba7a2a4c))
* wrong hooks where installed by default ([#385](https://github.com/dhis2/cli-style/issues/385)) ([3ac82f4](https://github.com/dhis2/cli-style/commit/3ac82f4d57031d911ff6c59419f3528e1a66ee40))

# [8.0.0-alpha.9](https://github.com/dhis2/cli-style/compare/v8.0.0-alpha.8...v8.0.0-alpha.9) (2021-04-21)


### Bug Fixes

* allow eslint to print colors ([#384](https://github.com/dhis2/cli-style/issues/384)) ([c95a184](https://github.com/dhis2/cli-style/commit/c95a1846c4ee3136cdc9005bd65296bbc1ab2bab))

# [8.0.0-alpha.8](https://github.com/dhis2/cli-style/compare/v8.0.0-alpha.7...v8.0.0-alpha.8) (2021-04-08)


### Features

* lint file system for consistent names ([#379](https://github.com/dhis2/cli-style/issues/379)) ([2bfb5ef](https://github.com/dhis2/cli-style/commit/2bfb5ef5ee2b26ff7e27594fe36cef9eb12b2360))

# [8.0.0-alpha.7](https://github.com/dhis2/cli-style/compare/v8.0.0-alpha.6...v8.0.0-alpha.7) (2021-04-07)


### Features

* delete deprecated configuration files ([c961647](https://github.com/dhis2/cli-style/commit/c9616479b053d313ccb177688d0bb410d7eef3e2))

# [8.0.0-alpha.6](https://github.com/dhis2/cli-style/compare/v8.0.0-alpha.5...v8.0.0-alpha.6) (2021-04-07)


### Bug Fixes

* match files from project root ([b77ef35](https://github.com/dhis2/cli-style/commit/b77ef35678000f9f597b12825b836c035158bc06))

# [8.0.0-alpha.5](https://github.com/dhis2/cli-style/compare/v8.0.0-alpha.4...v8.0.0-alpha.5) (2021-04-07)


### Features

* new and improved d2-style ([#378](https://github.com/dhis2/cli-style/issues/378)) ([f8279e5](https://github.com/dhis2/cli-style/commit/f8279e51b7d75033fa3c801721caa4ab1bad18d2))


### BREAKING CHANGES

* The verb (check/apply) is now moved to the top-level. E.g.
"d2-style js check" becomes "d2-style check js". This is to allow all checkers
to run with a single command: "d2-style check"
* "d2-style install" is no longer used to set up linters. As of
husky@5 the tool is vastly simplified and much faster. Hooks can be installed
manually with "d2-style install", but is also run as a "post-install" script
that we control for consistency. Configuration is added to the project with the
"d2-style add" command.

# [8.0.0-alpha.4](https://github.com/dhis2/cli-style/compare/v8.0.0-alpha.3...v8.0.0-alpha.4) (2021-03-15)


### Features

* commit check can read from a custom file ([366be0c](https://github.com/dhis2/cli-style/commit/366be0c693f39d2cc18bb546e845f68948ce4b9e))
* show eslint warnings ([#368](https://github.com/dhis2/cli-style/issues/368)) ([abe4668](https://github.com/dhis2/cli-style/commit/abe466895e561aeeffd4b2c2f07a20eec5c73f72))

# [8.0.0-alpha.2](https://github.com/dhis2/cli-style/compare/v8.0.0-alpha.1...v8.0.0-alpha.2) (2020-12-16)

# [8.0.0-alpha.3](https://github.com/dhis2/cli-style/compare/v8.0.0-alpha.2...v8.0.0-alpha.3) (2020-12-16)

# [8.0.0-alpha.2](https://github.com/dhis2/cli-style/compare/v8.0.0-alpha.1...v8.0.0-alpha.2) (2020-12-16)

### Features

* opt-in git hooks ([#333](https://github.com/dhis2/cli-style/issues/333)) ([a3bc415](https://github.com/dhis2/cli-style/commit/a3bc415d3971756e2ef53ab59dbbc4fb48046b07))

# [8.0.0-alpha.1](https://github.com/dhis2/cli-style/compare/v7.2.3...v8.0.0-alpha.1) (2020-12-16)

### Code Refactoring

* remove husky ([752b944](https://github.com/dhis2/cli-style/commit/752b94409a3a9735d324d05aefdd296f0d6bfb44))

### BREAKING CHANGES

* Husky has been removed from cli-style. You will need to
remove hooks that reference husky.sh in .git/hooks.

# [7.3.0](https://github.com/dhis2/cli-style/compare/v7.2.3...v7.3.0) (2020-12-16)

### Features

* **eslint:** add import order rule ([#334](https://github.com/dhis2/cli-style/issues/334)) ([c7b9991](https://github.com/dhis2/cli-style/commit/c7b99917e39b2ed16165d0a115f0e0c3ebe775e1))

# [8.0.0-alpha.2](https://github.com/dhis2/cli-style/compare/v8.0.0-alpha.1...v8.0.0-alpha.2) (2020-12-16)

### Features

* opt-in git hooks ([#333](https://github.com/dhis2/cli-style/issues/333)) ([a3bc415](https://github.com/dhis2/cli-style/commit/a3bc415d3971756e2ef53ab59dbbc4fb48046b07))

# [8.0.0-alpha.1](https://github.com/dhis2/cli-style/compare/v7.2.3...v8.0.0-alpha.1) (2020-12-16)


### Code Refactoring

* remove husky ([752b944](https://github.com/dhis2/cli-style/commit/752b94409a3a9735d324d05aefdd296f0d6bfb44))


### BREAKING CHANGES

* Husky has been removed from cli-style. You will need to
remove hooks that reference husky.sh in .git/hooks.

## [7.2.3](https://github.com/dhis2/cli-style/compare/v7.2.2...v7.2.3) (2020-12-16)


Expand Down
Empty file modified LICENSE
100644 → 100755
Empty file.
16 changes: 9 additions & 7 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
[![dhis2-cli Compatible](https://img.shields.io/badge/dhis2-cli-ff69b4.svg)](https://github.com/dhis2/cli)
[![@dhis2/cli-style on npm](https://img.shields.io/npm/v/@dhis2/cli-style.svg)](https://www.npmjs.com/package/@dhis2/cli-style)
[![travis.com build](https://img.shields.io/travis/com/dhis2/cli-style.svg)](https://travis-ci.com/dhis2/cli-style)
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)

Docs are available at [cli-style.dhis2.nu](https://cli-style.dhis2.nu).
Expand All @@ -21,21 +20,24 @@ As a terminal user check out the full CLI. :rocket:
This tool includes the following tools as runtime dependencies, so they
are not necessary to explicitly install:

- [Husky](https://github.com/typicode/husky)
- [Commitlint](https://commitlint.js.org)
- [ESLint](https://eslint.org/)
- [Prettier](https://prettier.io)
- [Husky](https://github.com/typicode/husky)
- [ls-lint](https://ls-lint.org/)

## Usage

```
npx d2-style --help
yarn d2-style --help
yarn d2-style install --help
npx d2-style install --help
yarn d2-style check --help
yarn d2-style check js --help
npx d2-style js --help
npx d2-style js check --help
npx d2-style js apply --help
yarn d2-style apply --help
yarn d2-style apply text --help
```

## Report an issue
Expand Down
Empty file modified config/commitlint.config.js
100644 → 100755
Empty file.
17 changes: 17 additions & 0 deletions config/d2-style.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
hooks: {
'commit-msg': ['yarn d2-style check commit "$1"'],
'pre-commit': ['yarn d2-style check --staged'],
},
tools: {
eslint: ['react'],
prettier: [],
github: ['dependabot', 'semantic-pr', 'stale'],
editorconfig: [],
commitlint: [],
},
patterns: {
js: '**/*.{js,jsx,ts,tsx}',
text: '**/*.{md,json,yml,html}',
},
}
File renamed without changes.
14 changes: 6 additions & 8 deletions config/js/eslint.config.js → config/eslint.config.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const SEVERITY = 2

module.exports = {
extends: [
'eslint:recommended',
Expand All @@ -8,7 +6,8 @@ module.exports = {
'plugin:import/warnings',
],

plugins: ['prettier'],
// unignore implicit rules about what types of files can be linted
ignorePatterns: ['!.*'],

env: {
browser: true,
Expand All @@ -28,22 +27,21 @@ module.exports = {

rules: {
'max-params': [
SEVERITY,
'error',
{
max: 3,
},
],
'prefer-const': [
SEVERITY,
'error',
{
destructuring: 'any',
ignoreReadBeforeAssign: false,
},
],
'no-mixed-spaces-and-tabs': [SEVERITY],
'prettier/prettier': [SEVERITY],
'no-mixed-spaces-and-tabs': ['error'],
'import/order': [
SEVERITY,
'error',
{
'newlines-between': 'never',
alphabetize: {
Expand Down
14 changes: 0 additions & 14 deletions config/husky-frontend.local.js

This file was deleted.

5 changes: 0 additions & 5 deletions config/husky.config.js

This file was deleted.

8 changes: 0 additions & 8 deletions config/husky.local.js

This file was deleted.

5 changes: 0 additions & 5 deletions config/js/browserslist.config.rc

This file was deleted.

File renamed without changes.
7 changes: 7 additions & 0 deletions d2-style.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
hooks: {
'commit-msg': ['./bin/d2-style check commit "$1"'],
'pre-commit': ['./bin/d2-style check'],
'pre-push': ['yarn test'],
},
}
Empty file modified docs/_sidebar.md
100644 → 100755
Empty file.
31 changes: 28 additions & 3 deletions docs/faq.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,40 @@

Some wisdom from Go:

> Gofmt's style is no one's favorite, yet gofmt is everyone's favorite.
> `gofmt`'s style is no one's favorite, yet `gofmt` is everyone's favorite.
# I'm getting husky errors

This library depends on husky, which requires node >= 10 and git >= 2.13.0. If you're getting errors like this:
This library as of version 8.0.0 no longer depends on husky, so if you
are getting errors like:

```
Can't find Husky, skipping pre-commit hook
You can reinstall it using 'npm install husky --save-dev' or delete this hook
```

Ensure that your node and git versions satisfy the above requirements. You can check this by running `git --version` and `node --version` from your terminal.
You can remove the husky hooks from `.git/hooks` and opt in to use the
hooks provided here with e.g. `d2-style install git-hooks/all`.

Ensure that your node and git versions satisfy the above requirements.
You can check this by running `git --version` and `node --version` from
your terminal.

# What does an Error and Warnings mean?

`d2-style` is strict by default, as it tries to guard against known lint
from entering the codebase. If the lint is denied early, it is easier,
and faster, to fix it.

We set most our style rules as error to serve this purpose. This works
best when `d2-style` is added to a project that doesn't have a lot of
code yet.

It is also not fun when `d2-style` decides to adopt new rules as errors.
That means by simply updating `d2-style` the codebase can be in need of
significant clean-ups. This is problematic because it can slow adoption
of new versions of the code style, and it can hold back adoption of new
and better code style rules.

To allow for gradual adoption of rules, warnings can be used before
upgrading them to errors.
Loading

0 comments on commit 717380b

Please sign in to comment.