Skip to content

Commit

Permalink
tools: move ESLint to tools/eslint
Browse files Browse the repository at this point in the history
Greatly simplify how ESLint and its plugins are installed.

PR-URL: #53413
Reviewed-By: Antoine du Hamel <[email protected]>
  • Loading branch information
targos authored Jun 19, 2024
1 parent 67c19c2 commit 2eff28f
Show file tree
Hide file tree
Showing 3,134 changed files with 7,888 additions and 5,208 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ indent_size = unset
indent_style = unset
trim_trailing_whitespace = unset

[{test/fixtures,deps,tools/node_modules,tools/gyp,tools/icu,tools/msvs}/**]
[{test/fixtures,deps,tools/eslint/node_modules,tools/gyp,tools/icu,tools/msvs}/**]
insert_final_newline = false
2 changes: 1 addition & 1 deletion .github/workflows/build-tarball.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
echo "TAR_DIR=$RUNNER_TEMP/`basename tarballs/*.tar.gz .tar.gz`" >> $GITHUB_ENV
- name: Copy directories needed for testing
run: |
cp -r tools/node_modules $TAR_DIR/tools
cp -r tools/eslint $TAR_DIR/tools
cp -r tools/eslint-rules $TAR_DIR/tools
- name: Build
run: |
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2003,7 +2003,7 @@ The externally maintained libraries used by Node.js are:
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""

- ESLint, located at tools/node_modules/eslint, is licensed as follows:
- ESLint, located at tools/eslint/node_modules/eslint, is licensed as follows:
"""
Copyright OpenJS Foundation and other contributors, <www.openjsf.org>

Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ $(TARBALL): release-only doc-only
$(RM) -r $(TARNAME)/tools/eslint
$(RM) -r $(TARNAME)/tools/eslint-rules
$(RM) -r $(TARNAME)/tools/license-builder.sh
$(RM) -r $(TARNAME)/tools/node_modules
$(RM) -r $(TARNAME)/tools/eslint/node_modules
$(RM) -r $(TARNAME)/tools/osx-*
$(RM) -r $(TARNAME)/tools/osx-pkg.pmdoc
find $(TARNAME)/deps/v8/test/* -type d ! -regex '.*/test/torque$$' | xargs $(RM) -r
Expand Down Expand Up @@ -1378,7 +1378,7 @@ format-md:

LINT_JS_TARGETS = eslint.config.mjs benchmark doc lib test tools

run-lint-js = tools/node_modules/eslint/bin/eslint.js --cache \
run-lint-js = tools/eslint/node_modules/eslint/bin/eslint.js --cache \
--max-warnings=0 --report-unused-disable-directives $(LINT_JS_TARGETS)
run-lint-js-fix = $(run-lint-js) --fix

Expand All @@ -1402,7 +1402,7 @@ lint-js lint-js-doc:
jslint: lint-js
$(warning Please use lint-js instead of jslint)

run-lint-js-ci = tools/node_modules/eslint/bin/eslint.js \
run-lint-js-ci = tools/eslint/node_modules/eslint/bin/eslint.js \
--max-warnings=0 --report-unused-disable-directives -f tap \
-o test-eslint.tap $(LINT_JS_TARGETS)

Expand Down Expand Up @@ -1562,7 +1562,7 @@ lint-yaml:

.PHONY: lint
.PHONY: lint-ci
ifneq ("","$(wildcard tools/node_modules/eslint/)")
ifneq ("","$(wildcard tools/eslint/node_modules/eslint/)")
lint: ## Run JS, C++, MD and doc linters.
@EXIT_STATUS=0 ; \
$(MAKE) lint-js || EXIT_STATUS=$$? ; \
Expand Down
2 changes: 1 addition & 1 deletion benchmark/misc/startup-cli-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const path = require('path');
// indispensible part of the CLI.
// NOTE: not all tools are present in tarball hence need to filter
const availableCli = [
'tools/node_modules/eslint/bin/eslint.js',
'tools/eslint/node_modules/eslint/bin/eslint.js',
'deps/npm/bin/npx-cli.js',
'deps/npm/bin/npm-cli.js',
'deps/corepack/dist/corepack.js',
Expand Down
2 changes: 1 addition & 1 deletion doc/contributing/collaborator-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ might impact an LTS release.
| `src/node_api.*` | @nodejs/node-api |
| `src/node_crypto.*`, `src/crypto` | @nodejs/crypto |
| `test/*` | @nodejs/testing |
| `tools/node_modules/eslint`, `eslint.config.mjs` | @nodejs/linting |
| `tools/eslint`, `eslint.config.mjs` | @nodejs/linting |
| build | @nodejs/build |
| `src/module_wrap.*`, `lib/internal/modules/*`, `lib/internal/vm/module.js` | @nodejs/modules |
| GYP | @nodejs/gyp |
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exclude = [
"tools/cpplint.py",
"tools/gyp",
"tools/inspector_protocol",
"tools/node_modules",
"tools/eslint/node_modules",
]
line-length = 172
target-version = "py37"
Expand Down
2 changes: 1 addition & 1 deletion test/common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ Skip the rest of the tests if the current terminal is a dumb terminal
### `skipIfEslintMissing()`

Skip the rest of the tests in the current file when `ESLint` is not available
at `tools/node_modules/eslint`
at `tools/eslint/node_modules/eslint`

### `skipIfInspectorDisabled()`

Expand Down
2 changes: 1 addition & 1 deletion test/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ function hasMultiLocalhost() {

function skipIfEslintMissing() {
if (!fs.existsSync(
path.join(__dirname, '..', '..', 'tools', 'node_modules', 'eslint'),
path.join(__dirname, '..', '..', 'tools', 'eslint', 'node_modules', 'eslint'),
)) {
skip('missing ESLint');
}
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-eslint-alphabetize-errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if ((!common.hasCrypto) || (!common.hasIntl)) {
}
common.skipIfEslintMissing();

const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
const RuleTester = require('../../tools/eslint/node_modules/eslint').RuleTester;
const rule = require('../../tools/eslint-rules/alphabetize-errors');

new RuleTester().run('alphabetize-errors', rule, {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-eslint-alphabetize-primordials.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if ((!common.hasCrypto) || (!common.hasIntl)) {

common.skipIfEslintMissing();

const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
const RuleTester = require('../../tools/eslint/node_modules/eslint').RuleTester;
const rule = require('../../tools/eslint-rules/alphabetize-primordials');

new RuleTester()
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-eslint-async-iife-no-unused-result.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if ((!common.hasCrypto) || (!common.hasIntl)) {
}
common.skipIfEslintMissing();

const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
const RuleTester = require('../../tools/eslint/node_modules/eslint').RuleTester;
const rule = require('../../tools/eslint-rules/async-iife-no-unused-result');

const message = 'The result of an immediately-invoked async function needs ' +
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-eslint-avoid-prototype-pollution.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if ((!common.hasCrypto) || (!common.hasIntl)) {

common.skipIfEslintMissing();

const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
const RuleTester = require('../../tools/eslint/node_modules/eslint').RuleTester;
const rule = require('../../tools/eslint-rules/avoid-prototype-pollution');

new RuleTester()
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-eslint-crypto-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if ((!common.hasCrypto) || (!common.hasIntl)) {

common.skipIfEslintMissing();

const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
const RuleTester = require('../../tools/eslint/node_modules/eslint').RuleTester;
const rule = require('../../tools/eslint-rules/crypto-check');

const message = 'Please add a hasCrypto check to allow this test to be ' +
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-eslint-documented-deprecation-codes.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if (!common.hasIntl)
common.skip('missing Intl');
common.skipIfEslintMissing();

const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
const RuleTester = require('../../tools/eslint/node_modules/eslint').RuleTester;
const rule = require('../../tools/eslint-rules/documented-deprecation-codes');

const mdFile = 'doc/api/deprecations.md';
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-eslint-documented-errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if ((!common.hasCrypto) || (!common.hasIntl)) {
}
common.skipIfEslintMissing();

const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
const RuleTester = require('../../tools/eslint/node_modules/eslint').RuleTester;
const rule = require('../../tools/eslint-rules/documented-errors');

const invalidCode = 'UNDOCUMENTED ERROR CODE';
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-eslint-duplicate-requires.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if ((!common.hasCrypto) || (!common.hasIntl)) {

common.skipIfEslintMissing();

const { RuleTester } = require('../../tools/node_modules/eslint');
const { RuleTester } = require('../../tools/eslint/node_modules/eslint');
const rule = require('../../tools/eslint-rules/no-duplicate-requires');

new RuleTester({
Expand Down
8 changes: 4 additions & 4 deletions test/parallel/test-eslint-eslint-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if ((!common.hasCrypto) || (!common.hasIntl)) {

common.skipIfEslintMissing();

const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
const RuleTester = require('../../tools/eslint/node_modules/eslint').RuleTester;
const rule = require('../../tools/eslint-rules/eslint-check');

const message = 'Please add a skipIfEslintMissing() call to allow this ' +
Expand All @@ -19,16 +19,16 @@ new RuleTester().run('eslint-check', rule, {
'foo;',
'require("common")\n' +
'common.skipIfEslintMissing();\n' +
'require("../../tools/node_modules/eslint")',
'require("../../tools/eslint/node_modules/eslint")',
],
invalid: [
{
code: 'require("common")\n' +
'require("../../tools/node_modules/eslint").RuleTester',
'require("../../tools/eslint/node_modules/eslint").RuleTester',
errors: [{ message }],
output: 'require("common")\n' +
'common.skipIfEslintMissing();\n' +
'require("../../tools/node_modules/eslint").RuleTester'
'require("../../tools/eslint/node_modules/eslint").RuleTester'
},
]
});
2 changes: 1 addition & 1 deletion test/parallel/test-eslint-inspector-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if ((!common.hasCrypto) || (!common.hasIntl)) {
}
common.skipIfEslintMissing();

const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
const RuleTester = require('../../tools/eslint/node_modules/eslint').RuleTester;
const rule = require('../../tools/eslint-rules/inspector-check');

const message = 'Please add a skipIfInspectorDisabled() call to allow this ' +
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-eslint-lowercase-name-for-primitive.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if ((!common.hasCrypto) || (!common.hasIntl)) {

common.skipIfEslintMissing();

const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
const RuleTester = require('../../tools/eslint/node_modules/eslint').RuleTester;
const rule = require('../../tools/eslint-rules/lowercase-name-for-primitive');

new RuleTester().run('lowercase-name-for-primitive', rule, {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-eslint-no-array-destructuring.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if ((!common.hasCrypto) || (!common.hasIntl)) {

common.skipIfEslintMissing();

const { RuleTester } = require('../../tools/node_modules/eslint');
const { RuleTester } = require('../../tools/eslint/node_modules/eslint');
const rule = require('../../tools/eslint-rules/no-array-destructuring');

const USE_OBJ_DESTRUCTURING =
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-eslint-no-unescaped-regexp-dot.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if ((!common.hasCrypto) || (!common.hasIntl)) {

common.skipIfEslintMissing();

const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
const RuleTester = require('../../tools/eslint/node_modules/eslint').RuleTester;
const rule = require('../../tools/eslint-rules/no-unescaped-regexp-dot');

new RuleTester().run('no-unescaped-regexp-dot', rule, {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-eslint-non-ascii-character.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if ((!common.hasCrypto) || (!common.hasIntl)) {

common.skipIfEslintMissing();

const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
const RuleTester = require('../../tools/eslint/node_modules/eslint').RuleTester;
const rule = require('../../tools/eslint-rules/non-ascii-character');

new RuleTester().run('non-ascii-characters', rule, {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-eslint-prefer-assert-iferror.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if ((!common.hasCrypto) || (!common.hasIntl)) {

common.skipIfEslintMissing();

const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
const RuleTester = require('../../tools/eslint/node_modules/eslint').RuleTester;
const rule = require('../../tools/eslint-rules/prefer-assert-iferror');

new RuleTester().run('prefer-assert-iferror', rule, {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-eslint-prefer-assert-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if ((!common.hasCrypto) || (!common.hasIntl)) {

common.skipIfEslintMissing();

const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
const RuleTester = require('../../tools/eslint/node_modules/eslint').RuleTester;
const rule = require('../../tools/eslint-rules/prefer-assert-methods');

new RuleTester().run('prefer-assert-methods', rule, {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-eslint-prefer-common-mustnotcall.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if ((!common.hasCrypto) || (!common.hasIntl)) {

common.skipIfEslintMissing();

const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
const RuleTester = require('../../tools/eslint/node_modules/eslint').RuleTester;
const rule = require('../../tools/eslint-rules/prefer-common-mustnotcall');

const message = 'Please use common.mustNotCall(msg) instead of ' +
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-eslint-prefer-common-mustsucceed.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if ((!common.hasCrypto) || (!common.hasIntl)) {

common.skipIfEslintMissing();

const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
const RuleTester = require('../../tools/eslint/node_modules/eslint').RuleTester;
const rule = require('../../tools/eslint-rules/prefer-common-mustsucceed');

const msg1 = 'Please use common.mustSucceed instead of ' +
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-eslint-prefer-primordials.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if ((!common.hasCrypto) || (!common.hasIntl)) {

common.skipIfEslintMissing();

const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
const RuleTester = require('../../tools/eslint/node_modules/eslint').RuleTester;
const rule = require('../../tools/eslint-rules/prefer-primordials');

new RuleTester({
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-eslint-prefer-proto.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if ((!common.hasCrypto) || (!common.hasIntl)) {

common.skipIfEslintMissing();

const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
const RuleTester = require('../../tools/eslint/node_modules/eslint').RuleTester;
const rule = require('../../tools/eslint-rules/prefer-proto');

new RuleTester().run('prefer-common-mustsucceed', rule, {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-eslint-prefer-util-format-errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if ((!common.hasCrypto) || (!common.hasIntl)) {

common.skipIfEslintMissing();

const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
const RuleTester = require('../../tools/eslint/node_modules/eslint').RuleTester;
const rule = require('../../tools/eslint-rules/prefer-util-format-errors');

new RuleTester()
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-eslint-require-common-first.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if ((!common.hasCrypto) || (!common.hasIntl)) {

common.skipIfEslintMissing();

const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
const RuleTester = require('../../tools/eslint/node_modules/eslint').RuleTester;
const rule = require('../../tools/eslint-rules/require-common-first');

new RuleTester({
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-eslint-required-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if ((!common.hasCrypto) || (!common.hasIntl)) {

common.skipIfEslintMissing();

const RuleTester = require('../../tools/node_modules/eslint').RuleTester;
const RuleTester = require('../../tools/eslint/node_modules/eslint').RuleTester;
const rule = require('../../tools/eslint-rules/required-modules');

new RuleTester({
Expand Down
Loading

0 comments on commit 2eff28f

Please sign in to comment.