Skip to content
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

enable ‘globstar’ #49

Merged
merged 1 commit into from
Nov 22, 2021
Merged

enable ‘globstar’ #49

merged 1 commit into from
Nov 22, 2021

Conversation

davidchambers
Copy link
Member

This configuration does not currently work as one might expect:

source-files = src/**/*.js

When the globstar shell option is not enabled, ** is not recursive; one must provide multiple patterns if the source files are not all siblings. In addition to being inelegant, src/*.js src/**/*.js is fragile as it hard-codes the maximum depth.

This pull request enables the globstar shell option before expanding source-files and readme-source-files. :)

The following script can be run once to demonstrate the existing behaviour and once to demonstrate the new behaviour:

#!/usr/bin/env bash
set -euf -o pipefail

cd "$(mktemp -d)"
pwd

tee package.json <<EOF
{
  "name": "repo-name",
  "version": "0.0.0",
  "devDependencies": {
    "sanctuary-scripts": "sanctuary-js/sanctuary-scripts#$1"
  },
  "scripts": {
    "doctest": "sanctuary-doctest",
    "lint": "sanctuary-lint",
    "release": "sanctuary-release",
    "test": "npm run lint && sanctuary-test && npm run doctest"
  }
}
EOF

tee .config <<EOF
repo-owner = repo-owner
repo-name = repo-name
source-files = foo/**/*.js
EOF

tee .eslintrc.json <<EOF
{
  "root": true,
  "extends": ["./node_modules/sanctuary-style/eslint-es6.json"]
}
EOF

touch CONTRIBUTING.md
touch LICENSE
touch .gitignore
touch .npmrc

mkdir -p foo/bar/baz
echo '"use strict"' >foo/index.js
echo '"use strict"' >foo/bar/index.js
echo '"use strict"' >foo/bar/baz/index.js

npm install
npm run lint

When run against master, only errors in foo/bar/index.js are reported. When run against davidchambers/globstar, errors in all three source files are reported.

Copy link
Member

@Avaq Avaq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙂👍

@davidchambers davidchambers merged commit ed5eba7 into master Nov 22, 2021
@davidchambers davidchambers deleted the davidchambers/globstar branch November 22, 2021 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants