Skip to content

Commit

Permalink
ESLint Plugin: Fix dependency group checking for CommonJS (#22230)
Browse files Browse the repository at this point in the history
* Packages: Resolve dependency group errors

* ESLint Plugin: Fix dependency group checking for CommonJS

* ESLint Plugin: Move changelog entry to Unreleased
  • Loading branch information
aduth committed May 22, 2020
1 parent 189da69 commit 70dd4cf
Show file tree
Hide file tree
Showing 52 changed files with 262 additions and 70 deletions.
2 changes: 1 addition & 1 deletion bin/api-docs/are-api-docs-unstaged.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node

/**
* Node dependencies.
* External dependencies
*/
const { extname } = require( 'path' );
const chalk = require( 'chalk' );
Expand Down
8 changes: 8 additions & 0 deletions bin/generate-public-grammar.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/usr/bin/env node

/**
* Internal dependencies
*/
const parser = require( '../node_modules/pegjs/lib/parser.js' );

/**
* External dependencies
*/
const fs = require( 'fs' );
const path = require( 'path' );
const grammarSource = fs.readFileSync(
Expand Down
4 changes: 2 additions & 2 deletions bin/plugin/commands/changelog.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
/**
* External dependencies
*/
const { groupBy } = require( 'lodash' );
const Octokit = require( '@octokit/rest' );

/*
/**
* Internal dependencies
*/
const { getNextMajorVersion } = require( '../lib/version' );
Expand Down
2 changes: 1 addition & 1 deletion bin/plugin/commands/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const fs = require( 'fs' );
const rimraf = require( 'rimraf' );
const semver = require( 'semver' );

/*
/**
* Internal dependencies
*/
const { log, formats } = require( '../lib/logger' );
Expand Down
2 changes: 1 addition & 1 deletion bin/plugin/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const { v4: uuid } = require( 'uuid' );
const path = require( 'path' );
const os = require( 'os' );

/*
/**
* Internal dependencies
*/
const { log, formats } = require( './logger' );
Expand Down
2 changes: 1 addition & 1 deletion docs/tool/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Node dependencies
* External dependencies
*/
const fs = require( 'fs' );
const path = require( 'path' );
Expand Down
2 changes: 1 addition & 1 deletion docs/tool/manifest.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Node dependencies
* External dependencies
*/
const { camelCase, nth, upperFirst } = require( 'lodash' );
const fs = require( 'fs' );
Expand Down
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@
"@storybook/react": "5.3.2",
"@testing-library/react": "10.0.2",
"@types/classnames": "2.2.10",
"@types/eslint": "6.8.0",
"@types/estree": "0.0.44",
"@types/lodash": "4.14.149",
"@types/prettier": "1.19.0",
"@types/qs": "6.9.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env node

/**
* External dependencies
*/
const pegjs = require( 'pegjs' );
const phpegjs = require( 'phpegjs' );
const fs = require( 'fs' );
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
/**
* External dependencies
*/

const { basename } = require( 'path' );

/**
* Internal dependencies
* WordPress dependencies
*/

const CustomTemplatedPathPlugin = require( '@wordpress/custom-templated-path-webpack-plugin' );

module.exports = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* Internal dependencies
*/
const DependencyExtractionWebpackPlugin = require( '../../..' );

module.exports = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* Internal dependencies
*/
const DependencyExtractionWebpackPlugin = require( '../../..' );

module.exports = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* Internal dependencies
*/
const DependencyExtractionWebpackPlugin = require( '../../..' );

module.exports = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* Internal dependencies
*/
const DependencyExtractionWebpackPlugin = require( '../../..' );

module.exports = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* Internal dependencies
*/
const DependencyExtractionWebpackPlugin = require( '../../..' );

module.exports = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* Internal dependencies
*/
const DependencyExtractionWebpackPlugin = require( '../../..' );

module.exports = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* Internal dependencies
*/
const DependencyExtractionWebpackPlugin = require( '../../..' );

module.exports = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* Internal dependencies
*/
const DependencyExtractionWebpackPlugin = require( '../../..' );

module.exports = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* Internal dependencies
*/
const DependencyExtractionWebpackPlugin = require( '../../..' );

module.exports = {
Expand Down
3 changes: 3 additions & 0 deletions packages/docgen/bin/cli.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env node

/**
* Internal dependencies
*/
const docgen = require( '../src' );

const optionator = require( 'optionator' )( {
Expand Down
4 changes: 2 additions & 2 deletions packages/docgen/src/engine.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/**
* External dependencies.
* External dependencies
*/
const babel = require( '@babel/core' );
const { flatten } = require( 'lodash' );

/**
* Internal dependencies.
* Internal dependencies
*/
const getIntermediateRepresentation = require( './get-intermediate-representation' );

Expand Down
4 changes: 2 additions & 2 deletions packages/docgen/src/get-intermediate-representation.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/**
* External dependencies.
* External dependencies
*/
const { get } = require( 'lodash' );

/**
* Internal dependencies.
* Internal dependencies
*/
const getExportEntries = require( './get-export-entries' );
const getJSDocFromToken = require( './get-jsdoc-from-token' );
Expand Down
4 changes: 2 additions & 2 deletions packages/docgen/src/get-jsdoc-from-token.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/**
* External dependencies.
* External dependencies
*/
const doctrine = require( 'doctrine' );

/**
* Internal dependencies.
* Internal dependencies
*/
const getLeadingComments = require( './get-leading-comments' );
const getTypeAsString = require( './get-type-as-string' );
Expand Down
2 changes: 1 addition & 1 deletion packages/docgen/src/get-leading-comments.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* External dependencies.
* External dependencies
*/
const { last } = require( 'lodash' );

Expand Down
4 changes: 2 additions & 2 deletions packages/docgen/src/markdown/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* External dependencies.
* External dependencies
*/
const remark = require( 'remark' );
const unified = require( 'unified' );
Expand All @@ -8,7 +8,7 @@ const inject = require( 'mdast-util-inject' );
const fs = require( 'fs' );

/**
* Internal dependencies.
* Internal dependencies
*/
const formatter = require( './formatter' );
const embed = require( './embed' );
Expand Down
2 changes: 1 addition & 1 deletion packages/docgen/src/test/engine.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Internal dependencies.
* Internal dependencies
*/
const engine = require( '../engine' );

Expand Down
2 changes: 1 addition & 1 deletion packages/docgen/src/test/formatter-markdown.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Internal dependencies.
* Internal dependencies
*/
const formatter = require( '../markdown/formatter' );

Expand Down
4 changes: 2 additions & 2 deletions packages/docgen/src/test/get-export-entries.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/**
* Node dependencies.
* External dependencies
*/
const fs = require( 'fs' );
const path = require( 'path' );

/**
* Internal dependencies.
* Internal dependencies
*/
const getExportEntries = require( '../get-export-entries' );

Expand Down
4 changes: 2 additions & 2 deletions packages/docgen/src/test/get-intermediate-representation.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/**
* Node dependencies.
* External dependencies
*/
const fs = require( 'fs' );
const path = require( 'path' );

/**
* Internal dependencies.
* Internal dependencies
*/
const getIntermediateRepresentation = require( '../get-intermediate-representation' );

Expand Down
2 changes: 1 addition & 1 deletion packages/docgen/src/test/get-jsdoc-from-token.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Internal dependencies.
* Internal dependencies
*/
const getJSDocFromToken = require( '../get-jsdoc-from-token' );

Expand Down
2 changes: 1 addition & 1 deletion packages/docgen/src/test/get-type-as-string.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Internal dependencies.
* Internal dependencies
*/
const getType = require( '../get-type-as-string' );

Expand Down
3 changes: 3 additions & 0 deletions packages/e2e-tests/config/performance-reporter.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* External dependencies
*/
const { readFileSync, existsSync } = require( 'fs' );
const chalk = require( 'chalk' );

Expand Down
6 changes: 5 additions & 1 deletion packages/eslint-plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

## Unreleased

### Bug Fixes

- `@wordpress/dependency-group` will now correctly identify issues associated with CommonJS (`require`) module imports.

## 6.0.0 (2020-05-14)

### Breaking Changes

- The severity of the rule, `jsdoc/no-undefined-types`, has been increased from `warn` to `error`. In addition, `JSX` has been added to the default list of defined types.
- The severity of the rule, `jsdoc/no-undefined-types`, has been increased from `warn` to `error`. In addition, `JSX` has been added to the default list of defined types.

### Improvements

Expand Down
Loading

0 comments on commit 70dd4cf

Please sign in to comment.