diff --git a/etc/eslint/plugin/index.js b/etc/eslint/plugin/index.js new file mode 100644 index 000000000000..5f842ba441c6 --- /dev/null +++ b/etc/eslint/plugin/index.js @@ -0,0 +1,22 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// eslint-disable-next-line stdlib/no-dynamic-exports, node/no-unpublished-require +module.exports = require( './../../../lib/node_modules/@stdlib/_tools/eslint/rules/scripts/plugin.js' ); diff --git a/etc/eslint/plugin/package.json b/etc/eslint/plugin/package.json new file mode 100644 index 000000000000..11ebb62b7b16 --- /dev/null +++ b/etc/eslint/plugin/package.json @@ -0,0 +1,38 @@ +{ + "name": "eslint-plugin-stdlib", + "version": "0.0.0", + "description": "ESLint plugin providing custom stdlib lint rules.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./index.js", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "keywords": [ + "stdlib", + "eslint", + "eslint-plugin", + "lint" + ] +} diff --git a/package.json b/package.json index e168d891abb3..14532c5b97e7 100644 --- a/package.json +++ b/package.json @@ -144,6 +144,7 @@ "eslint-plugin-expect-type": "^0.2.3", "eslint-plugin-import": "^2.29.0", "eslint-plugin-jsdoc": "^46.8.2", + "eslint-plugin-stdlib": "file:./etc/eslint/plugin", "exorcist": "^2.0.0", "factor-bundle": "^2.5.0", "gh-pages": "git+https://github.com/Planeshifter/gh-pages.git#main", diff --git a/tools/make/lib/init/Makefile b/tools/make/lib/init/Makefile index 383569c478a9..9adbcf1b5de0 100644 --- a/tools/make/lib/init/Makefile +++ b/tools/make/lib/init/Makefile @@ -19,14 +19,13 @@ # DEPENDENCIES # # Note: keep in alphabetical order... -include $(TOOLS_MAKE_LIB_DIR)/init/eslint.mk include $(TOOLS_MAKE_LIB_DIR)/init/git_hooks.mk # RULES # #/ -# Performs initialization tasks, such as installing Git hooks, installing custom lint plugins, etc. +# Performs initialization tasks, such as installing Git hooks. # # ## Notes # @@ -35,7 +34,7 @@ include $(TOOLS_MAKE_LIB_DIR)/init/git_hooks.mk # @example # make init #/ -init: init-git-hooks init-eslint-plugins +init: init-git-hooks $(QUIET) echo "Initialization successful." .PHONY: init diff --git a/tools/make/lib/init/README.md b/tools/make/lib/init/README.md index 62c3b9d8df09..30cb5b161f68 100644 --- a/tools/make/lib/init/README.md +++ b/tools/make/lib/init/README.md @@ -26,7 +26,7 @@ limitations under the License.
-This directory contains [`make`][make] rules for initializing the project development environment (e.g., adding [Git][git] hooks, installing custom ESLint plugins, etc). +This directory contains [`make`][make] rules for initializing the project development environment (e.g., adding [Git][git] hooks).
@@ -58,50 +58,6 @@ $ make init * * * -### ESLint - -#### init-eslint-rules-plugin - -Initializes custom [ESLint][eslint] rules. - - - -```bash -$ make init-eslint-rules-plugin -``` - -#### init-eslint-plugins - -Initializes custom [ESLint][eslint] plugins. - - - -```bash -$ make init-eslint-plugins -``` - -#### clean-eslint-rules-plugin - -Removes custom [ESLint][eslint] rules. - - - -```bash -$ make clean-eslint-rules-plugin -``` - -#### clean-eslint-plugins - -Removes custom [ESLint][eslint] plugins. - - - -```bash -$ make clean-eslint-plugins -``` - -* * * - ### Git #### init-git-hooks @@ -128,6 +84,22 @@ $ make init-git-hooks + + + + + + + + +
+ +
+ + + diff --git a/tools/make/lib/init/eslint.mk b/tools/make/lib/init/eslint.mk deleted file mode 100644 index 059cd131dad9..000000000000 --- a/tools/make/lib/init/eslint.mk +++ /dev/null @@ -1,122 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# VARIABLES # - -# Define the entry point of the plugin for project-specific custom ESLint rules: -stdlib_custom_eslint_rules_plugin_entry := $(TOOLS_PKGS_DIR)/eslint/rules/scripts/plugin.js - -# Define the plugin name for project-specific custom ESLint rules: -stdlib_custom_eslint_rules_plugin_name := eslint-plugin-stdlib - -# Define the output directory for the project-specific custom ESLint rules plugin: -stdlib_custom_eslint_rules_plugin_out := $(NODE_MODULES)/$(stdlib_custom_eslint_rules_plugin_name) - -# Define the contents of the custom ESLint rules plugin `package.json`: -stdlib_custom_eslint_rules_plugin_package_json := '{"name":"PLUGIN_NAME","version":"0.0.0","main":"index.js"}' -stdlib_custom_eslint_rules_plugin_package_json := $(subst PLUGIN_NAME,$(stdlib_custom_eslint_rules_plugin_name),$(stdlib_custom_eslint_rules_plugin_package_json)) - -# Define the build output prerequisites: -stdlib_custom_eslint_rules_plugin_prereqs := \ - $(stdlib_custom_eslint_rules_plugin_out)/index.js \ - $(stdlib_custom_eslint_rules_plugin_out)/package.json - - -# RULES # - -#/ -# Creates an output directory for installing a custom ESLint rules plugin. -# -# @private -#/ -$(stdlib_custom_eslint_rules_plugin_out): - $(QUIET) $(MKDIR_RECURSIVE) $@ - -#/ -# Creates the main entry point for a custom ESLint rules plugin. -# -# @private -#/ -$(stdlib_custom_eslint_rules_plugin_out)/index.js: $(NODE_MODULES) $(stdlib_custom_eslint_rules_plugin_entry) $(stdlib_custom_eslint_rules_plugin_out) - $(QUIET) NODE_PATH="$(NODE_PATH)" \ - $(BROWSERIFY) $(stdlib_custom_eslint_rules_plugin_entry) \ - --node \ - --ignore-missing \ - --outfile $@ \ - --standalone $(stdlib_custom_eslint_rules_plugin_name) - -#/ -# Creates a `package.json` for a custom ESLint rules plugin. -# -# @private -#/ -$(stdlib_custom_eslint_rules_plugin_out)/package.json: $(stdlib_custom_eslint_rules_plugin_out) - $(QUIET) printf $(stdlib_custom_eslint_rules_plugin_package_json) > $@ - -#/ -# Initializes custom [ESLint][eslint] rules. -# -# ## Notes -# -# - This rule bundles a custom ESLint rules plugin as a node module and installs the plugin in the project `node_modules` directory. -# -# [eslint]: https://eslint.org/ -# -# @example -# make init-eslint-rules-plugin -#/ -init-eslint-rules-plugin: clean-eslint-rules-plugin $(NODE_MODULES) $(stdlib_custom_eslint_rules_plugin_prereqs) - -.PHONY: init-eslint-rules-plugin - -#/ -# Initializes custom [ESLint][eslint] plugins. -# -# [eslint]: https://eslint.org/ -# -# @example -# make init-eslint-plugins -#/ -init-eslint-plugins: init-eslint-rules-plugin - -.PHONY: init-eslint-plugins - -#/ -# Removes a custom [ESLint][eslint] rule plugin. -# -# [eslint]: https://eslint.org/ -# -# @example -# make clean-eslint-rules-plugin -#/ -clean-eslint-rules-plugin: - $(QUIET) $(DELETE) $(DELETE_FLAGS) $(stdlib_custom_eslint_rules_plugin_out) - -.PHONY: clean-eslint-rules-plugin - -#/ -# Removes custom [ESLint][eslint] plugins. -# -# [eslint]: https://eslint.org/ -# -# @example -# make clean-eslint-plugins -#/ -clean-eslint-plugins: clean-eslint-rules-plugin - -.PHONY: clean-eslint-plugins