Skip to content

Commit

Permalink
Merge pull request #439 from dhis2/next
Browse files Browse the repository at this point in the history
chore(release): release next on latest
  • Loading branch information
varl authored Oct 29, 2021
2 parents c485fe7 + 51c0235 commit 9868e93
Show file tree
Hide file tree
Showing 27 changed files with 94 additions and 58 deletions.
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,38 @@
# [10.1.0](https://github.com/dhis2/cli-style/compare/v10.0.0...v10.1.0) (2021-10-29)


### Bug Fixes

* **add:** add project config for dhis2-artifacts workflow ([469c542](https://github.com/dhis2/cli-style/commit/469c5425d6a5ac9edffdd20020dbd4178e6c40c4))
* **ls-lint:** improve configuration template to fit most projects ([bd7ced7](https://github.com/dhis2/cli-style/commit/bd7ced78b78d004b1cf31b3d83ffdfe48668f378))
* **ls-lint:** improve ls-lint.yml so it works for normal and mono-repos ([d31e854](https://github.com/dhis2/cli-style/commit/d31e854d6aa22da74dd630e68d4698dc0251d8be))


### Features

* **renovate:** add renovate configuration setup ([89c9cc9](https://github.com/dhis2/cli-style/commit/89c9cc9178e2b98c949b016ee67c63b7e23393ce))

# [10.0.0](https://github.com/dhis2/cli-style/compare/v9.2.1...v10.0.0) (2021-09-20)


### Bug Fixes

* **prettier:** update configuration to latest ([b40f6e7](https://github.com/dhis2/cli-style/commit/b40f6e7922f5cdfd895af4950a56bbab9f51694d))

### Features

* **eslint:** enforce file extensions within the import path ([8f38ad1](https://github.com/dhis2/cli-style/commit/8f38ad1361f03863a4de089bd55f2e3edcdccd7e))


### BREAKING CHANGES

* **eslint:** import statements must specify the extension and will
now throw an error. The only exception is package imports.

## [9.3.1](https://github.com/dhis2/cli-style/compare/v9.3.0...v9.3.1) (2021-09-29)



### Bug Fixes

* **add:** add project config for dhis2-artifacts workflow ([469c542](https://github.com/dhis2/cli-style/commit/469c5425d6a5ac9edffdd20020dbd4178e6c40c4))
Expand Down
1 change: 1 addition & 0 deletions config/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@ module.exports = {
},
],
curly: ['error'],
'import/extensions': ['error', 'ignorePackages'],
},
}
11 changes: 7 additions & 4 deletions config/prettier.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ module.exports = {
useTabs: false,
semi: false,
singleQuote: true,
quoteProps: 'as-needed',
jsxSingleQuote: false,
trailingComma: 'es5',
bracketSpacing: true,
jsxBracketSameLine: false,
jsxSingleQuote: false,
arrowParens: 'avoid',
bracketSameLine: false,
arrowParens: 'always',
rangeStart: 0,
rangeEnd: Infinity,
proseWrap: 'preserve',
requirePragma: false,
insertPragma: false,
proseWrap: 'preserve',
htmlWhitespaceSensitivity: 'css',
endOfLine: 'lf',
embeddedLanguageFormatting: 'auto',
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dhis2/cli-style",
"version": "9.3.1",
"version": "10.1.0",
"description": "The code and commit style for DHIS2.",
"repository": {
"type": "git",
Expand Down Expand Up @@ -40,7 +40,7 @@
"husky": "^7.0.2",
"micromatch": "^4.0.4",
"perfy": "^1.1.5",
"prettier": "^2.3.1",
"prettier": "^2.4.1",
"semver": "^7.3.5",
"yargs": "^16.2.0"
},
Expand Down
2 changes: 1 addition & 1 deletion src/commands.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { packageConfigs, styleConfig } = require('./utils/config.js')

module.exports = yargs =>
module.exports = (yargs) =>
yargs
.config({
config: {
Expand Down
4 changes: 2 additions & 2 deletions src/commands/actions/editorconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exports.command = 'editorconfig [type]'

exports.desc = 'Add the editorconfig configuration to the project.'

exports.builder = yargs =>
exports.builder = (yargs) =>
yargs
.positional('type', {
describe: 'Template to use for EditorConfig',
Expand All @@ -21,7 +21,7 @@ exports.builder = yargs =>
'Adds the standard configuration to .editorconfig'
)

exports.handler = argv => {
exports.handler = (argv) => {
const { add, type, overwrite } = argv

log.info(`editorconfig > ${add ? 'add' : 'remove'}`)
Expand Down
4 changes: 2 additions & 2 deletions src/commands/actions/eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exports.command = 'eslint [type]'

exports.desc = 'Add ESLint configuration to the project.'

exports.builder = yargs =>
exports.builder = (yargs) =>
yargs
.positional('type', {
describe: 'Configuration template for ESLint.',
Expand All @@ -18,7 +18,7 @@ exports.builder = yargs =>
type: 'boolean',
})

exports.handler = argv => {
exports.handler = (argv) => {
const { add, type, overwrite } = argv

log.info(`eslint > ${add ? 'add' : 'remove'}`)
Expand Down
6 changes: 3 additions & 3 deletions src/commands/actions/git-hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { husky, supportedHooks } = require('../../tools/husky.js')
const { remove } = require('../../utils/config.js')
const { CONSUMING_ROOT, PROJECT_HOOKS_DIR } = require('../../utils/paths.js')

const defaultCommand = type =>
const defaultCommand = (type) =>
`echo "To customize this hook, edit ${type} in ${path.relative(
CONSUMING_ROOT,
PROJECT_HOOKS_DIR
Expand All @@ -14,7 +14,7 @@ exports.command = 'git-hook <type> [command]'

exports.desc = 'Add Git Hooks to the project.'

exports.builder = yargs =>
exports.builder = (yargs) =>
yargs
.positional('type', {
describe: 'Git Hook to register a command against.',
Expand All @@ -39,7 +39,7 @@ exports.builder = yargs =>
'Applies code style to staged files before committing.'
)

exports.handler = argv => {
exports.handler = (argv) => {
const { add, type, command, overwrite } = argv

log.info(`git-hook > ${add ? 'add' : 'remove'}`)
Expand Down
4 changes: 2 additions & 2 deletions src/commands/actions/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exports.command = 'github <type>'

exports.desc = 'Add configuration files for GitHub'

exports.builder = yargs =>
exports.builder = (yargs) =>
yargs
.positional('type', {
describe: 'Template to use for GitHub configuration',
Expand All @@ -25,7 +25,7 @@ exports.builder = yargs =>
'Adds the configuration file for Dependabot with DHIS2 defaults'
)

exports.handler = argv => {
exports.handler = (argv) => {
const { add, type, overwrite, getCache } = argv

log.info(`github > ${add ? 'add' : 'remove'}`)
Expand Down
4 changes: 2 additions & 2 deletions src/commands/actions/ls-lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exports.command = 'ls-lint [type]'

exports.desc = 'Lint file and directory names.'

exports.builder = yargs =>
exports.builder = (yargs) =>
yargs
.positional('type', {
describe: 'Configuration template to use for ls-lint',
Expand All @@ -21,7 +21,7 @@ exports.builder = yargs =>
'Adds the standard configuration to .ls-lint.yml'
)

exports.handler = argv => {
exports.handler = (argv) => {
const { add, type, overwrite } = argv

log.info(`ls-lint > ${add ? 'add' : 'remove'}`)
Expand Down
4 changes: 2 additions & 2 deletions src/commands/actions/prettier.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exports.command = 'prettier [type]'

exports.desc = 'Add the Prettier configuration to the project.'

exports.builder = yargs =>
exports.builder = (yargs) =>
yargs
.positional('type', {
describe: 'Configuration template to use for Prettier',
Expand All @@ -21,7 +21,7 @@ exports.builder = yargs =>
'Adds the standard configuration to .prettierrc.js'
)

exports.handler = argv => {
exports.handler = (argv) => {
const { add, type, overwrite } = argv

log.info(`prettier > ${add ? 'add' : 'remove'}`)
Expand Down
4 changes: 2 additions & 2 deletions src/commands/actions/renovate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exports.command = 'renovate [type]'

exports.desc = 'Lint file and directory names.'

exports.builder = yargs =>
exports.builder = (yargs) =>
yargs
.positional('type', {
describe: 'Configuration template to use for Renovate',
Expand All @@ -21,7 +21,7 @@ exports.builder = yargs =>
'Adds the standard configuration to renovate.json'
)

exports.handler = argv => {
exports.handler = (argv) => {
const { add, type, overwrite } = argv

log.info(`renovate > ${add ? 'add' : 'remove'}`)
Expand Down
2 changes: 1 addition & 1 deletion src/commands/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ exports.command = 'add'

exports.describe = 'Add a configuration file for a tool to the project.'

exports.builder = yargs =>
exports.builder = (yargs) =>
yargs
.commandDir('actions')
.config({
Expand Down
2 changes: 1 addition & 1 deletion src/commands/apply.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ exports.command = 'apply'
exports.describe =
'Apply code format and fix all lint issues that can be resolved automatically.'

exports.builder = yargs =>
exports.builder = (yargs) =>
jscmd(yargs)
/*
* Only list the types that can be automatically fixed here.
Expand Down
8 changes: 4 additions & 4 deletions src/commands/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ const { handler: textHandler } = require('./types/structured-text.js')

const statusCode = callback()

exports.jscmd = yargs =>
exports.jscmd = (yargs) =>
yargs.command(
'$0 [files..]',
'default',
yargs =>
(yargs) =>
yargs.positional('files', {
describe: '',
type: 'string',
}),
argv => {
(argv) => {
if (!argv.config.patterns) {
log.warn(
'No patterns defined, please check the configuration file'
Expand Down Expand Up @@ -52,7 +52,7 @@ exports.command = 'check'

exports.describe = 'Run all the configured checks for format and lint.'

exports.builder = yargs =>
exports.builder = (yargs) =>
this.jscmd(yargs)
/*
* Only list the types that can be checked here.
Expand Down
10 changes: 5 additions & 5 deletions src/commands/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ exports.command = 'install'

exports.describe = 'Install the project configuration into the local project.'

exports.builder = yargs => this.installcmd(yargs)
exports.builder = (yargs) => this.installcmd(yargs)

exports.installcmd = yargs =>
exports.installcmd = (yargs) =>
yargs.command(
'$0',
'default',
yargs =>
(yargs) =>
yargs.option('clean', {
describe: '',
type: 'boolean',
}),
argv => {
(argv) => {
const { config, clean } = argv

if (clean && fileExists(PROJECT_HOOKS_DIR)) {
Expand Down Expand Up @@ -60,7 +60,7 @@ exports.installcmd = yargs =>
if (isSupportedHook(hookType) && !fileExists(hookPath)) {
const hookCmds = config.hooks[hookType]

hookCmds.map(hookCmd =>
hookCmds.map((hookCmd) =>
husky({
command: 'add',
hookType,
Expand Down
2 changes: 1 addition & 1 deletion src/commands/remove.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ exports.command = 'remove'

exports.describe = 'Removes specified tool configuration files.'

exports.builder = yargs =>
exports.builder = (yargs) =>
yargs
.commandDir('actions')
.config({
Expand Down
4 changes: 2 additions & 2 deletions src/commands/types/commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exports.command = 'commit [file]'

exports.desc = 'Commit message validations.'

exports.builder = yargs =>
exports.builder = (yargs) =>
yargs
.positional('file', {
describe: 'File that contains the commit message',
Expand All @@ -23,7 +23,7 @@ exports.builder = yargs =>
type: 'string',
})

exports.handler = argv => {
exports.handler = (argv) => {
log.info(`commit-msg > commitlint`)

if (!gitEnabled()) {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/types/file-system.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exports.command = 'fs'
exports.aliases = ['file-system']
exports.desc = 'Lint file and directory names.'

exports.builder = yargs => yargs
exports.builder = (yargs) => yargs

exports.handler = (argv, callback) => {
const finalStatus = callback || runCb()
Expand Down
2 changes: 1 addition & 1 deletion src/commands/types/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ exports.aliases = ['javascript']

exports.desc = 'JavaScript code style'

exports.builder = yargs =>
exports.builder = (yargs) =>
yargs.positional('files', {
describe: '',
type: 'string',
Expand Down
2 changes: 1 addition & 1 deletion src/commands/types/structured-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const {
exports.command = 'text [files..]'
exports.aliases = ['structured-text']
exports.desc = 'Structured text style'
exports.builder = yargs =>
exports.builder = (yargs) =>
yargs.positional('files', {
describe: '',
type: 'string',
Expand Down
2 changes: 1 addition & 1 deletion src/tools/husky.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ exports.supportedHooks = [
'post-update',
]

exports.isSupportedHook = hook => this.supportedHooks.includes(hook)
exports.isSupportedHook = (hook) => this.supportedHooks.includes(hook)

exports.husky = ({ command, hookType, hookCmd, callback }) => {
const cmd = 'husky'
Expand Down
Loading

0 comments on commit 9868e93

Please sign in to comment.