Skip to content

Commit

Permalink
Fix, update, and sort _rc_ hasProjectFile filenames (#19994)
Browse files Browse the repository at this point in the history
* Update and fix `hasProjectFile` filenames

* Sort `hasProjectFile` filenames

* Update CHANGELOG.md
  • Loading branch information
ntwb authored Feb 2, 2020
1 parent d362cb1 commit 80c5239
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 11 deletions.
3 changes: 3 additions & 0 deletions packages/scripts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
- Add `lint-md-docs` script to lint the markup of markdown files, uses the `markdownlint` module ([#19855](https://github.com/WordPress/gutenberg/pull/19855)).
- Add `packages-update` script to update WordPress packages to the latest version automatically ([#19448](https://github.com/WordPress/gutenberg/pull/19448)).

### Bug Fixes
- Fixes and updates valid _rc_ configuration filenames for Babel, ESLint, markdownlint, npmpackagejsonlint, stylelint, and Prettier ([#19994](https://github.com/WordPress/gutenberg/pull/19994)).

## 6.1.1 (2020-01-01)

### Bug Fixes
Expand Down
8 changes: 4 additions & 4 deletions packages/scripts/scripts/format-js.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ function checkPrettier() {

// See: https://prettier.io/docs/en/configuration.html
const hasProjectPrettierConfig =
hasProjectFile( '.prettierrc' ) ||
hasProjectFile( '.prettierrc.js' ) ||
hasProjectFile( '.prettierrc.json' ) ||
hasProjectFile( '.prettierrc.toml' ) ||
hasProjectFile( '.prettierrc.yaml' ) ||
hasProjectFile( '.prettierrc.yml' ) ||
hasProjectFile( '.prettierrc.js' ) ||
hasProjectFile( '.prettierrc.config.js' ) ||
hasProjectFile( '.prettierrc.toml' ) ||
hasProjectFile( 'prettier.config.js' ) ||
hasProjectFile( '.prettierrc' ) ||
hasPackageProp( 'prettier' );

if ( ! hasProjectPrettierConfig ) {
Expand Down
3 changes: 2 additions & 1 deletion packages/scripts/scripts/lint-js.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ const hasLintConfig =
hasArgInCLI( '-c' ) ||
hasArgInCLI( '--config' ) ||
hasProjectFile( '.eslintrc.js' ) ||
hasProjectFile( '.eslintrc.json' ) ||
hasProjectFile( '.eslintrc.yaml' ) ||
hasProjectFile( '.eslintrc.yml' ) ||
hasProjectFile( '.eslintrc.json' ) ||
hasProjectFile( 'eslintrc.config.js' ) ||
hasProjectFile( '.eslintrc' ) ||
hasPackageProp( 'eslintConfig' );

Expand Down
3 changes: 2 additions & 1 deletion packages/scripts/scripts/lint-md-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ const hasLintConfig =
hasArgInCLI( '--config' ) ||
hasProjectFile( '.markdownlint.json' ) ||
hasProjectFile( '.markdownlint.yaml' ) ||
hasProjectFile( '.markdownlint.yml' );
hasProjectFile( '.markdownlint.yml' ) ||
hasProjectFile( '.markdownlintrc' );

// When a configuration is not provided by the project, use from the default
// provided with the scripts module.
Expand Down
6 changes: 5 additions & 1 deletion packages/scripts/scripts/lint-pkg-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@ const args = getArgsFromCLI();

const defaultFilesArgs = hasFileArgInCLI() ? [] : [ '.' ];

// See: https://github.com/tclindner/npm-package-json-lint/wiki/configuration#configuration.
// See: https://npmpackagejsonlint.org/docs/en/configuration
const hasLintConfig =
hasArgInCLI( '-c' ) ||
hasArgInCLI( '--configFile' ) ||
hasProjectFile( '.npmpackagejsonlintrc.js' ) ||
hasProjectFile( '.npmpackagejsonlintrc.json' ) ||
hasProjectFile( '.npmpackagejsonlintrc.yaml' ) ||
hasProjectFile( '.npmpackagejsonlintrc.yml' ) ||
hasProjectFile( 'npmpackagejsonlint.config.js' ) ||
hasProjectFile( '.npmpackagejsonlintrc' ) ||
hasPackageProp( 'npmpackagejsonlint' ) ||
// npm-package-json-lint v3.x used a different prop name.
hasPackageProp( 'npmPackageJsonLintConfig' );
Expand Down
6 changes: 3 additions & 3 deletions packages/scripts/scripts/lint-style.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ const args = getArgsFromCLI();

const defaultFilesArgs = hasFileArgInCLI() ? [] : [ '**/*.{css,scss}' ];

// See: https://github.com/stylelint/stylelint/blob/master/docs/user-guide/configuration.md#loading-the-configuration-object.
// See: https://stylelint.io/user-guide/configuration
const hasLintConfig =
hasArgInCLI( '--config' ) ||
hasProjectFile( '.stylelintrc' ) ||
hasProjectFile( '.stylelintrc.js' ) ||
hasProjectFile( '.stylelintrc.json' ) ||
hasProjectFile( '.stylelintrc.yaml' ) ||
hasProjectFile( '.stylelintrc.yml' ) ||
hasProjectFile( '.stylelint.config.js' ) ||
hasProjectFile( 'stylelint.config.js' ) ||
hasProjectFile( '.stylelintrc' ) ||
hasPackageProp( 'stylelint' );

const defaultConfigArgs = ! hasLintConfig
Expand Down
5 changes: 4 additions & 1 deletion packages/scripts/utils/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ const {
const { fromConfigRoot, hasProjectFile } = require( './file' );
const { hasPackageProp } = require( './package' );

// See https://babeljs.io/docs/en/config-files#configuration-file-types
const hasBabelConfig = () =>
hasProjectFile( '.babelrc' ) ||
hasProjectFile( '.babelrc.js' ) ||
hasProjectFile( '.babelrc.json' ) ||
hasProjectFile( 'babel.config.js' ) ||
hasProjectFile( 'babel.config.json' ) ||
hasProjectFile( '.babelrc' ) ||
hasPackageProp( 'babel' );

const hasJestConfig = () =>
Expand Down

0 comments on commit 80c5239

Please sign in to comment.