@coko/lint 3.0.0-alpha.3 → 3.0.0-alpha.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,189 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [3.0.0-alpha.31](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.30...v3.0.0-alpha.31) (2026-05-04)
6
+
7
+
8
+ ### Features
9
+
10
+ * **eslint:** more nuanced root config ([d8f7fc2](https://gitlab.coko.foundation/cokoapps/lint/commit/d8f7fc2fb9926bdfc92e66712b468827936efd48))
11
+
12
+ ## [3.0.0-alpha.30](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.29...v3.0.0-alpha.30) (2026-05-04)
13
+
14
+
15
+ ### Features
16
+
17
+ * allow passing path to the lint commands ([dd7a355](https://gitlab.coko.foundation/cokoapps/lint/commit/dd7a35561e0757f03d11d192f60b43834a63ce56))
18
+
19
+ ## [3.0.0-alpha.29](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.28...v3.0.0-alpha.29) (2026-04-29)
20
+
21
+
22
+ ### Features
23
+
24
+ * **eslint:** export root eslint config ([5b2c6d5](https://gitlab.coko.foundation/cokoapps/lint/commit/5b2c6d50377b40ad8b84b4188ac4fd35a226502a))
25
+
26
+ ## [3.0.0-alpha.28](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.27...v3.0.0-alpha.28) (2026-04-28)
27
+
28
+
29
+ ### Bug Fixes
30
+
31
+ * **eslint:** fix cz config issues on the client side ([11f92ed](https://gitlab.coko.foundation/cokoapps/lint/commit/11f92ed65f709a9e8a69012b91b5d8d0b72d0288))
32
+
33
+ ## [3.0.0-alpha.27](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.26...v3.0.0-alpha.27) (2026-04-27)
34
+
35
+
36
+ ### Bug Fixes
37
+
38
+ * **stylelint:** properly disable rule ([24c16b6](https://gitlab.coko.foundation/cokoapps/lint/commit/24c16b619d431f26c33d33268cb4f085a859cc1b))
39
+
40
+ ## [3.0.0-alpha.26](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.25...v3.0.0-alpha.26) (2026-04-27)
41
+
42
+
43
+ ### Features
44
+
45
+ * **stylelint:** allow empty source ([64eb3b8](https://gitlab.coko.foundation/cokoapps/lint/commit/64eb3b83e3a8200432e5e624b3458cf43328bbd3))
46
+
47
+ ## [3.0.0-alpha.25](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.24...v3.0.0-alpha.25) (2026-04-23)
48
+
49
+
50
+ ### Features
51
+
52
+ * **eslint:** add root config with cypress plugin ([6078f5b](https://gitlab.coko.foundation/cokoapps/lint/commit/6078f5bf6e451903738a8eda6f288b7f52ee3877))
53
+ * **eslint:** enable the eslint plugin promises config ([00a6f56](https://gitlab.coko.foundation/cokoapps/lint/commit/00a6f5644eb4f4c371577abdcf4e869383faae0d))
54
+ * **stylelint:** modern stylelint configuration ([9741171](https://gitlab.coko.foundation/cokoapps/lint/commit/974117104009e9b3a254b9539d8082198d68553c))
55
+
56
+ ## [3.0.0-alpha.24](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.23...v3.0.0-alpha.24) (2026-02-04)
57
+
58
+
59
+ ### Features
60
+
61
+ * **eslint:** add process to client globals ([4e12d2d](https://gitlab.coko.foundation/cokoapps/lint/commit/4e12d2d3c892636297516e6ca6c8afa24076d276))
62
+
63
+ ## [3.0.0-alpha.23](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.22...v3.0.0-alpha.23) (2026-02-03)
64
+
65
+
66
+ ### Bug Fixes
67
+
68
+ * fix position of react detect setting in object ([eb81055](https://gitlab.coko.foundation/cokoapps/lint/commit/eb81055ada1dd3f11cc161640491a93455c4e13f))
69
+
70
+ ## [3.0.0-alpha.22](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.21...v3.0.0-alpha.22) (2026-02-03)
71
+
72
+
73
+ ### Features
74
+
75
+ * **eslint:** detect react version ([3f5d4fe](https://gitlab.coko.foundation/cokoapps/lint/commit/3f5d4fe1c64fa0bd455d56f386ee646030b5917e))
76
+
77
+ ## [3.0.0-alpha.21](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.20...v3.0.0-alpha.21) (2026-01-26)
78
+
79
+
80
+ ### Bug Fixes
81
+
82
+ * **eslint:** no extensions for jsx/tsx files ([25ec578](https://gitlab.coko.foundation/cokoapps/lint/commit/25ec5782e79c2960a56d5416a995093148f90411))
83
+
84
+ ## [3.0.0-alpha.20](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.19...v3.0.0-alpha.20) (2026-01-26)
85
+
86
+
87
+ ### Bug Fixes
88
+
89
+ * **eslint:** export client config ([5d4df78](https://gitlab.coko.foundation/cokoapps/lint/commit/5d4df78d62005544afc2143e83ca951ddad07c56))
90
+
91
+ ## [3.0.0-alpha.19](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.18...v3.0.0-alpha.19) (2026-01-23)
92
+
93
+
94
+ ### Features
95
+
96
+ * **eslint:** add client config ([ac6878a](https://gitlab.coko.foundation/cokoapps/lint/commit/ac6878ae6f3934eccdb0d48c4a39331311fe6ce2))
97
+
98
+ ## [3.0.0-alpha.18](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.17...v3.0.0-alpha.18) (2026-01-20)
99
+
100
+
101
+ ### Bug Fixes
102
+
103
+ * fix commit command ([9934d20](https://gitlab.coko.foundation/cokoapps/lint/commit/9934d2075bfea115265400df4d6be864f1f8eed8))
104
+
105
+ ## [3.0.0-alpha.17](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.16...v3.0.0-alpha.17) (2026-01-20)
106
+
107
+
108
+ ### Features
109
+
110
+ * add lint-staged and commit commands ([dcff789](https://gitlab.coko.foundation/cokoapps/lint/commit/dcff78993000a4df6ef0e35f67057d5de05682d7))
111
+
112
+ ## [3.0.0-alpha.16](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.15...v3.0.0-alpha.16) (2026-01-19)
113
+
114
+
115
+ ### Bug Fixes
116
+
117
+ * include file extension for commitizen import ([3911856](https://gitlab.coko.foundation/cokoapps/lint/commit/3911856673e137136e1754563259c254f158a20d))
118
+
119
+ ## [3.0.0-alpha.15](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.14...v3.0.0-alpha.15) (2026-01-19)
120
+
121
+
122
+ ### Bug Fixes
123
+
124
+ * fix package.json index path ([4bac830](https://gitlab.coko.foundation/cokoapps/lint/commit/4bac8300f6a1e6e83544c61c9b8d8b2daa4451c9))
125
+
126
+ ## [3.0.0-alpha.14](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.13...v3.0.0-alpha.14) (2026-01-19)
127
+
128
+
129
+ ### Bug Fixes
130
+
131
+ * fix cli import of package.json ([c4325d2](https://gitlab.coko.foundation/cokoapps/lint/commit/c4325d2a7757b8dfac224d1edb7cc827df9ab12e))
132
+
133
+ ## [3.0.0-alpha.13](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.12...v3.0.0-alpha.13) (2026-01-19)
134
+
135
+
136
+ ### Bug Fixes
137
+
138
+ * fix cli path in package.json ([e7dae84](https://gitlab.coko.foundation/cokoapps/lint/commit/e7dae84139742c11bab104e0e7c4bece95964c50))
139
+
140
+ ## [3.0.0-alpha.12](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.11...v3.0.0-alpha.12) (2026-01-19)
141
+
142
+ ## [3.0.0-alpha.11](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.10...v3.0.0-alpha.11) (2026-01-19)
143
+
144
+ ## [3.0.0-alpha.10](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.9...v3.0.0-alpha.10) (2025-12-02)
145
+
146
+
147
+ ### Bug Fixes
148
+
149
+ * **eslint:** do not autofix vitest/no-focused-tests ([717897e](https://gitlab.coko.foundation/cokoapps/lint/commit/717897e1b072c651008c52ebddaf7df9cdbbdfb3))
150
+
151
+ ## [3.0.0-alpha.9](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.8...v3.0.0-alpha.9) (2025-12-01)
152
+
153
+
154
+ ### Features
155
+
156
+ * **eslint:** add workspaces plugin ([0bfb382](https://gitlab.coko.foundation/cokoapps/lint/commit/0bfb382057548895c92cd53282745457d8ba0b5e))
157
+
158
+ ## [3.0.0-alpha.8](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.7...v3.0.0-alpha.8) (2025-11-18)
159
+
160
+
161
+ ### Bug Fixes
162
+
163
+ * **eslint:** allow unused vars if they start with _ ([3f2fca0](https://gitlab.coko.foundation/cokoapps/lint/commit/3f2fca094ea69f9b5560f07851083bea637bd3ed))
164
+
165
+ ## [3.0.0-alpha.7](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.6...v3.0.0-alpha.7) (2025-11-06)
166
+
167
+
168
+ ### Bug Fixes
169
+
170
+ * **eslint:** disable vitest typecheck ([3184e6e](https://gitlab.coko.foundation/cokoapps/lint/commit/3184e6ec614639584c5e31c45a039931accf36fa))
171
+
172
+ ## [3.0.0-alpha.6](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.5...v3.0.0-alpha.6) (2025-11-06)
173
+
174
+
175
+ ### Features
176
+
177
+ * **eslint:** add vitest plugin ([92a0f86](https://gitlab.coko.foundation/cokoapps/lint/commit/92a0f864f91b7a67b4c65de841757223290e1b63))
178
+
179
+ ## [3.0.0-alpha.5](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.4...v3.0.0-alpha.5) (2025-11-06)
180
+
181
+
182
+ ### Bug Fixes
183
+
184
+ * **eslint:** refine new eslint rules ([caca5f4](https://gitlab.coko.foundation/cokoapps/lint/commit/caca5f45e743725ce259704328a85c7791d33f6f))
185
+
186
+ ## [3.0.0-alpha.4](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.3...v3.0.0-alpha.4) (2025-11-06)
187
+
5
188
  ## [3.0.0-alpha.3](https://gitlab.coko.foundation/cokoapps/lint/compare/v3.0.0-alpha.2...v3.0.0-alpha.3) (2025-10-24)
6
189
 
7
190
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coko/lint",
3
- "version": "3.0.0-alpha.3",
3
+ "version": "3.0.0-alpha.31",
4
4
  "description": "Linter configurations and dependencies for coko's projects",
5
5
  "keywords": [
6
6
  "lint",
@@ -9,22 +9,22 @@
9
9
  ],
10
10
  "repository": {
11
11
  "type": "git",
12
- "url": "git@gitlab.coko.foundation:cokoapps/lint.git"
12
+ "url": "https://gitlab.coko.foundation/cokoapps/lint"
13
13
  },
14
14
  "license": "MIT",
15
15
  "author": "Yannis Barlas",
16
16
  "engines": {
17
- "node": "^22.16.0"
17
+ "node": ">= 22"
18
18
  },
19
19
  "main": "src/index.mjs",
20
20
  "bin": {
21
- "coko-lint": "./src/cli.js"
21
+ "coko-lint": "./src/cli.mjs"
22
22
  },
23
23
  "files": [
24
24
  "src"
25
25
  ],
26
26
  "scripts": {
27
- "cz": "git-cz",
27
+ "commit": "./src/cli.mjs commit --skip-stylelint",
28
28
  "prepare": "husky install",
29
29
  "release": "standard-version",
30
30
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -35,50 +35,37 @@
35
35
  }
36
36
  },
37
37
  "dependencies": {
38
- "@babel/core": "^7.28.4",
39
- "@babel/eslint-parser": "^7.28.4",
40
- "@babel/preset-react": "^7.27.1",
41
- "@commitlint/cli": "^20.1.0",
42
- "@commitlint/config-conventional": "^20.0.0",
43
- "@eslint/eslintrc": "^3.3.1",
44
- "@eslint/js": "^9.38.0",
45
- "commander": "^14.0.1",
38
+ "@eslint/js": "^9.39.2",
39
+ "@vitest/eslint-plugin": "^1.6.6",
40
+ "chalk": "^5.6.2",
41
+ "commander": "^14.0.2",
46
42
  "commitizen": "^4.3.1",
47
- "conventional-commit-types": "^3.0.0",
48
- "cz-conventional-changelog": "^3.3.0",
49
- "cz-customizable": "^6.9.0",
50
- "eslint": "^9.38.0",
51
- "eslint-config-airbnb": "^19.0.4",
43
+ "confusing-browser-globals": "^1.0.11",
44
+ "cz-customizable": "^7.5.1",
45
+ "eslint": "^9.39.2",
52
46
  "eslint-config-prettier": "^10.1.8",
53
- "eslint-config-standard": "^17.1.0",
54
- "eslint-config-standard-react": "^13.0.0",
55
47
  "eslint-import-resolver-typescript": "^4.4.4",
56
- "eslint-plugin-cypress": "^5.2.0",
48
+ "eslint-plugin-cypress": "^5.2.1",
57
49
  "eslint-plugin-import": "^2.32.0",
58
- "eslint-plugin-jest": "^29.0.1",
59
50
  "eslint-plugin-jsx-a11y": "^6.10.2",
60
- "eslint-plugin-n": "^17.23.1",
51
+ "eslint-plugin-n": "^17.23.2",
61
52
  "eslint-plugin-promise": "^7.2.1",
62
53
  "eslint-plugin-react": "^7.37.5",
63
- "eslint-plugin-react-hooks": "^7.0.0",
64
- "globals": "^16.4.0",
65
- "husky": "^9.1.7",
66
- "lint-staged": "^16.2.6",
67
- "longest": "^2.0.1",
54
+ "eslint-plugin-react-hooks": "^7.0.1",
55
+ "eslint-plugin-workspaces": "^0.11.1",
56
+ "globals": "^17.0.0",
57
+ "lint-staged": "^16.2.7",
68
58
  "postcss": "^8.5.6",
69
- "postcss-scss": "^4.0.9",
70
- "prettier": "^3.6.2",
71
- "right-pad": "^1.0.1",
72
- "stylelint": "^16.25.0",
73
- "stylelint-config-standard-scss": "^16.0.0",
74
- "stylelint-config-styled-components": "^0.1.1",
75
- "stylelint-order": "^7.0.0",
76
- "stylelint-processor-styled-components": "^1.10.0",
59
+ "postcss-styled-syntax": "^0.7.1",
60
+ "prettier": "^3.8.0",
61
+ "stylelint": "^17.1.1",
62
+ "stylelint-config-standard": "^40.0.0",
77
63
  "typescript": "^5.9.3",
78
- "typescript-eslint": "^8.46.2"
64
+ "typescript-eslint": "^8.53.0"
79
65
  },
80
66
  "devDependencies": {
81
- "standard-version": "^9.5.0"
67
+ "standard-version": "^9.5.0",
68
+ "styled-components": "^6.3.8"
82
69
  },
83
70
  "publishConfig": {
84
71
  "access": "public"
package/src/cli.mjs ADDED
@@ -0,0 +1,205 @@
1
+ #!/usr/bin/env node
2
+
3
+ /* eslint-disable n/no-process-exit */
4
+
5
+ import { execSync } from 'node:child_process'
6
+ import path from 'node:path'
7
+ import { createRequire } from 'node:module'
8
+
9
+ import { program } from 'commander'
10
+ import lintStagedLib from 'lint-staged'
11
+
12
+ import pkg from '../package.json' with { type: 'json' }
13
+ import logger from './logger.mjs'
14
+
15
+ const require = createRequire(import.meta.url)
16
+ const cz = require('commitizen/dist/cli/git-cz')
17
+ const czPath = require.resolve('commitizen')
18
+
19
+ const ESLINT = 'ESLint'
20
+ const STYLELINT = 'Stylelint'
21
+ const PRETTIER = 'Prettier'
22
+ const filler = '>>>> '
23
+
24
+ // #region actions
25
+ const printVersion = () => {
26
+ logger.info(`Coko lint version: ${program.version()}\n`)
27
+ }
28
+
29
+ const runCommand = (name, command, isSubprocess) => {
30
+ logger.info(`\n${filler}Running ${name}...`)
31
+
32
+ try {
33
+ execSync(command, { stdio: 'inherit' })
34
+ } catch (error) {
35
+ logger.error(`Error running ${name}: ${error.message}`)
36
+
37
+ if (isSubprocess) {
38
+ throw new Error()
39
+ } else {
40
+ process.exit(1)
41
+ }
42
+ }
43
+ }
44
+
45
+ const runSubprocess = (fn, name, skip) => {
46
+ try {
47
+ if (skip) {
48
+ logger.info(`\n${filler}Skipping ${name}...`)
49
+ return
50
+ }
51
+
52
+ fn(true)
53
+ } catch {
54
+ throw new Error()
55
+ }
56
+ }
57
+
58
+ const runESLint = (isSubprocess, targetPath) => {
59
+ const target = targetPath ?? process.cwd()
60
+ const command = `npx eslint ${target}`
61
+ runCommand(ESLINT, command, isSubprocess)
62
+ }
63
+
64
+ const runStylelint = (isSubprocess, targetPath) => {
65
+ const target = targetPath
66
+ ? `"${targetPath}/**/*.{js,jsx,ts,tsx,css}"`
67
+ : `"${process.cwd()}/**/*.{js,jsx,ts,tsx,css}"`
68
+ const command = `npx stylelint ${target}`
69
+ runCommand(STYLELINT, command, isSubprocess)
70
+ }
71
+
72
+ const runPrettier = (isSubprocess, targetPath) => {
73
+ const target = targetPath ?? process.cwd()
74
+ const command = `npx prettier --check ${target}`
75
+ runCommand(PRETTIER, command, isSubprocess)
76
+ }
77
+
78
+ const runAll = (options = {}) => {
79
+ let hasErrors = false
80
+
81
+ const processes = [
82
+ [runESLint, ESLINT, options.skipEslint],
83
+ [runStylelint, STYLELINT, options.skipStylelint],
84
+ [runPrettier, PRETTIER, options.skipPrettier],
85
+ ]
86
+
87
+ for (const process of processes) {
88
+ try {
89
+ runSubprocess(...process)
90
+ } catch {
91
+ hasErrors = true
92
+ }
93
+ }
94
+
95
+ if (hasErrors) {
96
+ logger.error('\nError: Linting checks did not pass!')
97
+ process.exit(1)
98
+ }
99
+
100
+ logger.info(`\nLinting checks successfully passed`)
101
+ }
102
+
103
+ const lintStaged = async options => {
104
+ const jsArray = ['eslint']
105
+ if (!options.skipStylelint) jsArray.push('stylelint')
106
+
107
+ const success = await lintStagedLib({
108
+ cwd: process.cwd(),
109
+ config: {
110
+ '*.{js,mjs}': jsArray,
111
+ '*.{js,graphql,json,yml,md,html}': ['prettier --check'],
112
+ },
113
+ })
114
+
115
+ logger.newLine()
116
+ if (!success) throw new Error('Lint staged failed!')
117
+ logger.info('Lint staged successfully completed')
118
+ }
119
+
120
+ const commit = async options => {
121
+ execSync('git add -A', { stdio: 'inherit' })
122
+ execSync('git status', { stdio: 'inherit' })
123
+
124
+ await lintStaged(options)
125
+ logger.newLine()
126
+
127
+ // filter out
128
+ // - the 'commit' command
129
+ // - the --skip-stylelint flag
130
+ // if we don't do this, cz will pass them onto git (which will throw)
131
+ process.argv = process.argv.slice(0, 2)
132
+
133
+ cz.bootstrap({
134
+ cliPath: path.join(czPath, '..', '..'),
135
+ })
136
+ }
137
+ // #endregion actions
138
+
139
+ program
140
+ .name('coko-lint')
141
+ .version(pkg.version)
142
+ .description("Coko's cli tool for running linters")
143
+
144
+ program
145
+ .command('eslint [path]')
146
+ .description('Run eslint command')
147
+ .action(targetPath => {
148
+ printVersion()
149
+ runESLint(false, targetPath)
150
+ })
151
+
152
+ program
153
+ .command('stylelint [path]')
154
+ .description('Run stylelint command')
155
+ .action(targetPath => {
156
+ printVersion()
157
+ runStylelint(false, targetPath)
158
+ })
159
+
160
+ program
161
+ .command('prettier [path]')
162
+ .description('Run prettier command')
163
+ .action(targetPath => {
164
+ printVersion()
165
+ runPrettier(false, targetPath)
166
+ })
167
+
168
+ program
169
+ .command('run')
170
+ .description('Run all commands (eslint, stylelint, prettier)')
171
+ .option('--skip-eslint', 'Skip eslint')
172
+ .option('--skip-stylelint', 'Skip stylelint')
173
+ .option('--skip-prettier', 'Skip prettier')
174
+ .action(options => {
175
+ printVersion()
176
+ runAll(options)
177
+ })
178
+
179
+ program
180
+ .command('lint-staged')
181
+ .description('Lint staged files')
182
+ .option('--skip-stylelint', 'Skip stylelint')
183
+ .action(async options => {
184
+ try {
185
+ printVersion()
186
+ await lintStaged(options)
187
+ } catch (e) {
188
+ throw new Error(e)
189
+ }
190
+ })
191
+
192
+ program
193
+ .command('commit')
194
+ .description('Launch interactive commit builder')
195
+ .option('--skip-stylelint', 'Skip stylelint')
196
+ .action(async options => {
197
+ try {
198
+ printVersion()
199
+ await commit(options)
200
+ } catch (e) {
201
+ throw new Error(e)
202
+ }
203
+ })
204
+
205
+ program.parse(process.argv)
package/src/commitizen.js CHANGED
@@ -1,15 +1,62 @@
1
- const longest = require('longest')
2
- const rightPad = require('right-pad')
3
- const conventionalCommitTypes = require('conventional-commit-types')
1
+ // https://github.com/commitizen/conventional-commit-types/blob/master/index.json
2
+ const types = {
3
+ feat: {
4
+ description: 'A new feature',
5
+ title: 'Features',
6
+ },
7
+ fix: {
8
+ description: 'A bug fix',
9
+ title: 'Bug Fixes',
10
+ },
11
+ docs: {
12
+ description: 'Documentation only changes',
13
+ title: 'Documentation',
14
+ },
15
+ style: {
16
+ description:
17
+ 'Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)',
18
+ title: 'Styles',
19
+ },
20
+ refactor: {
21
+ description: 'A code change that neither fixes a bug nor adds a feature',
22
+ title: 'Code Refactoring',
23
+ },
24
+ perf: {
25
+ description: 'A code change that improves performance',
26
+ title: 'Performance Improvements',
27
+ },
28
+ test: {
29
+ description: 'Adding missing tests or correcting existing tests',
30
+ title: 'Tests',
31
+ },
32
+ build: {
33
+ description:
34
+ 'Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)',
35
+ title: 'Builds',
36
+ },
37
+ ci: {
38
+ description:
39
+ 'Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)',
40
+ title: 'Continuous Integrations',
41
+ },
42
+ chore: {
43
+ description: "Other changes that don't modify src or test files",
44
+ title: 'Chores',
45
+ },
46
+ revert: {
47
+ description: 'Reverts a previous commit',
48
+ title: 'Reverts',
49
+ },
50
+ }
4
51
 
5
- // Borrowed from cz-conventional-changelog
6
- const { types } = conventionalCommitTypes
7
- const length = longest(Object.keys(types)).length + 1
52
+ const maxLength = Math.max(Object.keys(types).map(key => key.length)) + 1
8
53
 
9
54
  const choices = Object.keys(types).map(key => {
10
55
  const type = types[key]
56
+ const name = `${`${key}:`.padEnd(maxLength)} ${type.description}`
57
+
11
58
  return {
12
- name: `${rightPad(`${key}:`, length)} ${type.description}`,
59
+ name,
13
60
  value: key,
14
61
  }
15
62
  })