Skip to content

Commit 9e59a68

Browse files
marcod1419simpleimpulse
authored andcommitted
chore(scripts): prevent contributor updates from causing scope error (#191)
1 parent d0ab9c5 commit 9e59a68

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

scripts/commit-scope-lint.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const fs = require('fs')
88
const rootScopes = ['deps', 'other'] // Scopes where modified files are typically in the repo's root.
99
const dotScopes = { github: '.github' } // Scopes that map to dotfolders
1010
const bypassScopes = ['publish'] // Scopes that bypass the check and allow any file to be modified in a commit.
11+
const excludedFiles = ['.all-contributorsrc', 'README.md'] // Files that can be modified with any scope.
1112

1213
const getCommitScope = () => {
1314
const commitMessage = fs.readFileSync(process.argv[3], 'utf8')
@@ -34,9 +35,10 @@ if (bypassScopes.indexOf(commitScope) === -1) {
3435
.map(element => element.replace('-', ''))
3536
.forEach(element => {
3637
if (
37-
(rootScopes.indexOf(commitScope) === -1 &&
38+
((rootScopes.indexOf(commitScope) === -1 &&
3839
element.search(new RegExp(`^(.*(/+)|(/?))${commitScope}/`, 'i')) === -1) ||
39-
(rootScopes.indexOf(commitScope) !== -1 && element.search(/(\\)|(\/)/g) !== -1)
40+
(rootScopes.indexOf(commitScope) !== -1 && element.search(/(\\)|(\/)/g) !== -1)) &&
41+
excludedFiles.indexOf(element) === -1
4042
) {
4143
console.error(
4244
'\n',

0 commit comments

Comments
 (0)