diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 0203f7e1345c..000000000000 --- a/.eslintignore +++ /dev/null @@ -1,37 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2018 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. -#/ - -# Files # -######### -!.*.js -!.*.ts - -# Directories # -############### -build/ -reports/ -/dist/ - -# Node.js # -########### -/node_modules/ -!/**/node_modules/* - -# Git # -####### -.git* diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 0bfa6a817256..000000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MODULES // - -var eslint = require( './etc/eslint/.eslintrc.overrides.js' ); - - -// EXPORTS // - -module.exports = eslint; diff --git a/eslint.config.js b/eslint.config.js index 55fbf87dd461..b52d1d49581d 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -34,13 +34,49 @@ var pluginImport = require( 'eslint-plugin-import' ); var pluginExpectType = require( 'eslint-plugin-expect-type' ); var assign = require( './lib/node_modules/@stdlib/object/assign' ); var stdlibPlugin = require( './lib/node_modules/@stdlib/_tools/eslint/rules/scripts/plugin.js' ); -var restrictedSyntaxConfig = require( './etc/eslint/overrides/restricted_syntax.js' ); var rules = require( './etc/eslint/rules' ); var tsRules = require( './etc/eslint/rules/typescript.js' ); // VARIABLES // +var restrictedSyntaxConfig = [ + 'error', + 'ArrowFunctionExpression', + 'ClassBody', + 'ClassDeclaration', + 'ClassExpression', + 'DebuggerStatement', + 'ExperimentalRestProperty', + 'ExperimentalSpreadProperty', + 'LabeledStatement', + 'RestElement', + 'SpreadElement', + 'TaggedTemplateExpression', + 'TemplateElement', + 'TemplateLiteral', + 'WithStatement', + 'YieldExpression', + 'JSXIdentifier', + 'JSXNamespacedName', + 'JSXMemberExpression', + 'JSXEmptyExpression', + 'JSXExpressionContainer', + 'JSXElement', + 'JSXClosingElement', + 'JSXOpeningElement', + 'JSXAttribute', + 'JSXSpreadAttribute', + 'JSXText', + 'ExportDefaultDeclaration', + 'ExportNamedDeclaration', + 'ExportAllDeclaration', + 'ExportSpecifier', + 'ImportDeclaration', + 'ImportSpecifier', + 'ImportDefaultSpecifier', + 'ImportNamespaceSpecifier' +]; var tsGlobalVars; var globalVars; var config; diff --git a/etc/eslint/.eslintrc.benchmarks.js b/etc/eslint/.eslintrc.benchmarks.js deleted file mode 100644 index a6e05a620f67..000000000000 --- a/etc/eslint/.eslintrc.benchmarks.js +++ /dev/null @@ -1,141 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ - -/* eslint-disable stdlib/no-empty-lines-between-requires */ - -'use strict'; - -// MODULES // - -// FIXME: remove the next line and uncomment the subsequent line once all remark JSDoc ESLint rules are completed -var copy = require( './../../lib/node_modules/@stdlib/utils/copy' ); - -// var copy = require( './utils/copy.js' ); -var defaults = require( './.eslintrc.js' ); - - -// MAIN // - -/** -* ESLint configuration. -* -* @namespace eslint -*/ -var eslint = copy( defaults ); - -/** -* Warn when using `String`, `Number`, and `Boolean` in place of primitives. -* -* @private -*/ -eslint.rules[ 'no-new-wrappers' ] = 'warn'; - -/** -* Override the limit for source code lines in a file. -* -* @private -*/ -eslint.rules[ 'max-lines' ] = [ 'warn', { - 'max': 1000, - 'skipBlankLines': true, - 'skipComments': true -}]; - -/** -* Override list of restricted syntax. -* -* @private -*/ -eslint.rules[ 'no-restricted-syntax' ] = [ 'error', - 'ArrowFunctionExpression', - 'ClassBody', - 'ClassDeclaration', - 'ClassExpression', - 'DebuggerStatement', - 'ExperimentalRestProperty', - 'ExperimentalSpreadProperty', - - // 'FunctionExpression', - 'LabeledStatement', - 'RestElement', - 'SpreadElement', - 'TaggedTemplateExpression', - 'TemplateElement', - 'TemplateLiteral', - 'WithStatement', - 'YieldExpression', - 'JSXIdentifier', - 'JSXNamespacedName', - 'JSXMemberExpression', - 'JSXEmptyExpression', - 'JSXExpressionContainer', - 'JSXElement', - 'JSXClosingElement', - 'JSXOpeningElement', - 'JSXAttribute', - 'JSXSpreadAttribute', - 'JSXText', - 'ExportDefaultDeclaration', - 'ExportNamedDeclaration', - 'ExportAllDeclaration', - 'ExportSpecifier', - 'ImportDeclaration', - 'ImportSpecifier', - 'ImportDefaultSpecifier', - 'ImportNamespaceSpecifier' -]; - -/** -* Do not require JSDoc comments. -* -* @private -*/ -eslint.rules[ 'jsdoc/require-jsdoc' ] = 'off'; - -/** -* Do not require `@private` annotations. -* -* @private -*/ -eslint.rules[ 'stdlib/jsdoc-private-annotation' ] = 'off'; - -/** -* Do not lint return annotation values in JSDoc comments. -* -* @private -*/ -eslint.rules[ 'stdlib/jsdoc-doctest' ] = 'off'; - -/** -* Do not enforce nested function elevation. -* -* @private -*/ -eslint.rules[ 'stdlib/no-unnecessary-nested-functions' ] = 'off'; - -/** -* Disallow using string concatenation in benchmark descriptions. -* -* @private -*/ -eslint.rules[ 'stdlib/no-bench-string-concat' ] = 'error'; - - -// EXPORTS // - -module.exports = eslint; diff --git a/etc/eslint/.eslintrc.examples.js b/etc/eslint/.eslintrc.examples.js deleted file mode 100644 index 6e1f23f83c51..000000000000 --- a/etc/eslint/.eslintrc.examples.js +++ /dev/null @@ -1,107 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ - -/* eslint-disable stdlib/no-empty-lines-between-requires */ - -'use strict'; - -// MODULES // - -// FIXME: remove the next line and uncomment the subsequent line once all remark JSDoc ESLint rules are completed -var copy = require( './../../lib/node_modules/@stdlib/utils/copy' ); - -// var copy = require( './utils/copy.js' ); -var defaults = require( './.eslintrc.js' ); - - -// MAIN // - -/** -* ESLint configuration. -* -* @namespace eslint -*/ -var eslint = copy( defaults ); - -/** -* Warn when using `String`, `Number`, and `Boolean` in place of primitives. -* -* @private -*/ -eslint.rules[ 'no-new-wrappers' ] = 'warn'; - -/** -* Allow variables to be declared as needed. -* -* @private -*/ -eslint.rules[ 'vars-on-top' ] = 'off'; - -/** -* Allow using `console`. -* -* @private -*/ -eslint.rules[ 'no-console' ] = 'off'; - -/** -* Do not require JSDoc comments. -* -* @private -*/ -eslint.rules[ 'jsdoc/require-jsdoc' ] = 'off'; - -/** -* Do not require `@private` annotations. -* -* @private -*/ -eslint.rules[ 'stdlib/jsdoc-private-annotation' ] = 'off'; - -/** -* Do not lint return annotation values in JSDoc comments. -* -* @private -*/ -eslint.rules[ 'stdlib/jsdoc-doctest' ] = 'off'; - -/** -* Lint return annotation values. -* -* @private -*/ -eslint.rules[ 'stdlib/doctest' ] = 'error'; - -/** -* Do not require ordering of variable declarations inside of functions. -* -* @private -*/ -eslint.rules[ 'stdlib/vars-order' ] = 'off'; - -/** -* Enforce that last `require` is a relative path. -* -* @private -*/ -eslint.rules[ 'stdlib/require-last-path-relative' ] = 'error'; - - -// EXPORTS // - -module.exports = eslint; diff --git a/etc/eslint/.eslintrc.js b/etc/eslint/.eslintrc.js index f82b404483f1..3717a116b14f 100644 --- a/etc/eslint/.eslintrc.js +++ b/etc/eslint/.eslintrc.js @@ -55,15 +55,6 @@ eslint.env = require( './env' ); */ eslint.rules = require( './rules' ); -/** -* Overrides. -* -* @name overrides -* @memberof eslint -* @type {Array} -*/ -eslint.overrides = require( './overrides/source.js' ); - /** * Parser options. * diff --git a/etc/eslint/.eslintrc.overrides.js b/etc/eslint/.eslintrc.overrides.js deleted file mode 100644 index 8b603bf87967..000000000000 --- a/etc/eslint/.eslintrc.overrides.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MODULES // - -// FIXME: remove the next line and uncomment the subsequent line once all remark JSDoc ESLint rules are completed -var copy = require( './../../lib/node_modules/@stdlib/utils/copy' ); - -// var copy = require( './utils/copy.js' ); -var defaults = require( './.eslintrc.js' ); - - -// MAIN // - -/** -* ESLint configuration. -* -* @namespace eslint -*/ -var eslint = copy( defaults ); - -/** -* Overrides. -* -* @name overrides -* @memberof eslint -* @type {Array} -*/ -eslint.overrides = require( './overrides' ); - - -// EXPORTS // - -module.exports = eslint; diff --git a/etc/eslint/.eslintrc.tests.js b/etc/eslint/.eslintrc.tests.js deleted file mode 100644 index d48acdeb7d89..000000000000 --- a/etc/eslint/.eslintrc.tests.js +++ /dev/null @@ -1,155 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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. -*/ - -/* eslint-disable stdlib/no-empty-lines-between-requires */ - -'use strict'; - -// MODULES // - -// FIXME: remove the next line and uncomment the subsequent line once all remark JSDoc ESLint rules are completed -var copy = require( './../../lib/node_modules/@stdlib/utils/copy' ); - -// var copy = require( './utils/copy.js' ); -var defaults = require( './.eslintrc.js' ); - - -// MAIN // - -/** -* ESLint configuration. -* -* @namespace eslint -*/ -var eslint = copy( defaults ); - -/** -* Allow empty functions. -* -* @private -*/ -eslint.rules[ 'no-empty-function' ] = 'off'; - -/** -* Warn when using `String`, `Number`, and `Boolean` in place of primitives. -* -* @private -*/ -eslint.rules[ 'no-new-wrappers' ] = 'warn'; - -/** -* Override the limit for source code lines in a file. -* -* @private -*/ -eslint.rules[ 'max-lines' ] = [ 'warn', { - 'max': 1000, - 'skipBlankLines': true, - 'skipComments': true -}]; - -/** -* Override list of restricted syntax. -* -* @private -*/ -eslint.rules[ 'no-restricted-syntax' ] = [ 'error', - 'ArrowFunctionExpression', - 'ClassBody', - 'ClassDeclaration', - 'ClassExpression', - 'DebuggerStatement', - 'ExperimentalRestProperty', - 'ExperimentalSpreadProperty', - - // 'FunctionExpression', - 'LabeledStatement', - 'RestElement', - 'SpreadElement', - 'TaggedTemplateExpression', - 'TemplateElement', - 'TemplateLiteral', - 'WithStatement', - 'YieldExpression', - 'JSXIdentifier', - 'JSXNamespacedName', - 'JSXMemberExpression', - 'JSXEmptyExpression', - 'JSXExpressionContainer', - 'JSXElement', - 'JSXClosingElement', - 'JSXOpeningElement', - 'JSXAttribute', - 'JSXSpreadAttribute', - 'JSXText', - 'ExportDefaultDeclaration', - 'ExportNamedDeclaration', - 'ExportAllDeclaration', - 'ExportSpecifier', - 'ImportDeclaration', - 'ImportSpecifier', - 'ImportDefaultSpecifier', - 'ImportNamespaceSpecifier' -]; - -/** -* Do not require JSDoc comments. -* -* @private -*/ -eslint.rules[ 'jsdoc/require-jsdoc' ] = 'off'; - -/** -* Do not require `@private` annotations. -* -* @private -*/ -eslint.rules[ 'stdlib/jsdoc-private-annotation' ] = 'off'; - -/** -* Do not lint return annotation values in JSDoc comments. -* -* @private -*/ -eslint.rules[ 'stdlib/jsdoc-doctest' ] = 'off'; - -/** -* When testing, allow requiring the package as a whole even though only a single property is used. -* -* @private -*/ -eslint.rules[ 'stdlib/no-single-property-require' ] = 'off'; - -/** -* Do not enforce nested function elevation. -* -* @private -*/ -eslint.rules[ 'stdlib/no-unnecessary-nested-functions' ] = 'off'; - -/** -* Allow the use of `undefined`. -* -* @private -*/ -eslint.rules[ 'no-undefined' ] = 'off'; - - -// EXPORTS // - -module.exports = eslint; diff --git a/etc/eslint/overrides/index.js b/etc/eslint/overrides/index.js deleted file mode 100644 index 6b45d71d8051..000000000000 --- a/etc/eslint/overrides/index.js +++ /dev/null @@ -1,148 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var restrictedSyntaxConfig = require( './restricted_syntax.js' ); - - -// MAIN // - -/** -* ESLint overrides. -* -* @namespace overrides -*/ -var overrides = [ - { - 'files': [ 'etc/eslint/rules/*.js' ], - 'rules': { - 'stdlib/jsdoc-doctest': 'off' - } - }, - { - 'files': [ '[a-z].js' ], - 'rules': { - 'stdlib/repl-namespace-order': 'error' - } - }, - { - 'files': [ '**/benchmark/*.js' ], - 'rules': { - 'no-new-wrappers': 'warn', - 'max-lines': [ 'warn', { - 'max': 1000, - 'skipBlankLines': true, - 'skipComments': true - }], - 'no-restricted-syntax': restrictedSyntaxConfig, - 'jsdoc/require-jsdoc': 'off', - 'stdlib/jsdoc-private-annotation': 'off', - 'stdlib/jsdoc-doctest': 'off', - 'stdlib/no-unnecessary-nested-functions': 'off' - } - }, - { - 'files': [ '**/examples/*.js' ], - 'rules': { - 'no-new-wrappers': 'warn', - 'vars-on-top': 'off', - 'no-console': 'off', - 'jsdoc/require-jsdoc': 'off', - 'stdlib/jsdoc-private-annotation': 'off', - 'stdlib/jsdoc-doctest': 'off', - 'stdlib/no-unnecessary-nested-functions': 'off', - 'stdlib/vars-order': 'off' - } - }, - { - 'files': [ '**/test/*.js' ], - 'rules': { - 'no-empty-function': 'off', - 'no-new-wrappers': 'warn', - 'max-lines': [ 'warn', { - 'max': 1000, - 'skipBlankLines': true, - 'skipComments': true - }], - 'no-restricted-syntax': restrictedSyntaxConfig, - 'jsdoc/require-jsdoc': 'off', - 'stdlib/jsdoc-private-annotation': 'off', - 'stdlib/jsdoc-doctest': 'off', - 'stdlib/no-single-property-require': 'off', - 'stdlib/no-unnecessary-nested-functions': 'off', - 'no-undefined': 'off' - } - }, - { - 'files': [ '*.md' ], - 'rules': { - 'eol-last': 'off', - 'indent': [ 'error', 4, { - 'SwitchCase': 0, - 'VariableDeclarator': 1, - 'outerIIFEBody': 1, - 'MemberExpression': 1, - 'FunctionDeclaration': { - 'body': 1, - 'parameters': 'off' - }, - 'FunctionExpression': { - 'body': 1, - 'parameters': 'off' - }, - 'CallExpression': { - 'arguments': 'off' - }, - 'ArrayExpression': 1, - 'ObjectExpression': 1, - 'flatTernaryExpressions': true - }], - 'no-console': 'off', - 'no-sync': 'off', - 'no-tabs': 'error', - 'no-undef': 'off', - 'no-unused-vars': 'off', - 'jsdoc/require-jsdoc': 'off', - 'stdlib/jsdoc-private-annotation': 'off', - 'stdlib/jsdoc-return-annotations-values': 'off', - 'stdlib/no-single-property-require': 'off', - 'stdlib/no-unnecessary-nested-functions': 'off', - 'stdlib/return-annotations-values': 'off', - 'strict': 'off', - 'vars-on-top': 'off', - 'n/no-unpublished-require': 'off' - } - }, - { - 'files': [ '*.d.ts' ], - 'extends': resolve( __dirname, '..', '.eslintrc.typescript.js' ) - }, - { - 'files': [ '**/test/*.ts' ], - 'extends': resolve( __dirname, '..', '.eslintrc.typescript.tests.js' ) - } -]; - - -// EXPORTS // - -module.exports = overrides; diff --git a/etc/eslint/overrides/restricted_syntax.js b/etc/eslint/overrides/restricted_syntax.js deleted file mode 100644 index d33a9d190bb7..000000000000 --- a/etc/eslint/overrides/restricted_syntax.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @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'; - -// MAIN // - -var rule = [ 'error', - 'ArrowFunctionExpression', - 'ClassBody', - 'ClassDeclaration', - 'ClassExpression', - 'DebuggerStatement', - 'ExperimentalRestProperty', - 'ExperimentalSpreadProperty', - - // 'FunctionExpression', - 'LabeledStatement', - 'RestElement', - 'SpreadElement', - 'TaggedTemplateExpression', - 'TemplateElement', - 'TemplateLiteral', - 'WithStatement', - 'YieldExpression', - 'JSXIdentifier', - 'JSXNamespacedName', - 'JSXMemberExpression', - 'JSXEmptyExpression', - 'JSXExpressionContainer', - 'JSXElement', - 'JSXClosingElement', - 'JSXOpeningElement', - 'JSXAttribute', - 'JSXSpreadAttribute', - 'JSXText', - 'ExportDefaultDeclaration', - 'ExportNamedDeclaration', - 'ExportAllDeclaration', - 'ExportSpecifier', - 'ImportDeclaration', - 'ImportSpecifier', - 'ImportDefaultSpecifier', - 'ImportNamespaceSpecifier' -]; - - -// EXPORTS // - -module.exports = rule; diff --git a/etc/eslint/overrides/source.js b/etc/eslint/overrides/source.js deleted file mode 100644 index 2a4c31b0eee1..000000000000 --- a/etc/eslint/overrides/source.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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'; - -// MAIN // - -/** -* ESLint overrides for JavaScript source files. -* -* @namespace overrides -*/ -var overrides = [ - { - 'files': [ 'etc/eslint/rules/*.js' ], - 'rules': { - 'stdlib/jsdoc-doctest': 'off' - } - }, - { - 'files': [ '[a-z].js' ], - 'rules': { - 'stdlib/repl-namespace-order': 'error' - } - } -]; - - -// EXPORTS // - -module.exports = overrides;