chore(jsdoc-eslint-config): migrate to ESLint flat config

This commit is contained in:
Jeff Williams 2024-04-14 11:39:46 -07:00
parent ae2c9da9ba
commit 55b0489662
No known key found for this signature in database
42 changed files with 334 additions and 298 deletions

View File

@ -1,14 +0,0 @@
# Ignore output files.
**/out/
# Ignore temp directories.
**/tmp/
# Ignore code coverage reports.
coverage/
# Ignore static files that are part of JSDoc's output.
packages/**/static/**
# Ignore test fixtures.
packages/**/test/fixtures/**

View File

@ -13,7 +13,17 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
module.exports = {
extends: ['@jsdoc'], import jsdoc from '@jsdoc/eslint-config';
root: true,
}; export default [
{
files: ['packages/**/test/**'],
languageOptions: {
globals: {
jsdoc: 'readonly',
},
},
},
...jsdoc,
];

54
package-lock.json generated
View File

@ -455,9 +455,9 @@
} }
}, },
"node_modules/@eslint/eslintrc/node_modules/globals": { "node_modules/@eslint/eslintrc/node_modules/globals": {
"version": "13.21.0", "version": "13.24.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-13.21.0.tgz", "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz",
"integrity": "sha512-ybyme3s4yy/t/3s35bewwXKOf7cvzfreG2lH0lZl0JB7I4GxRP2ghxOK/Nb9EkRXdbBXZLfq/p/0W2JUONB/Gg==", "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==",
"dependencies": { "dependencies": {
"type-fest": "^0.20.2" "type-fest": "^0.20.2"
}, },
@ -545,9 +545,9 @@
} }
}, },
"node_modules/@humanwhocodes/object-schema": { "node_modules/@humanwhocodes/object-schema": {
"version": "2.0.2", "version": "2.0.3",
"resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz", "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz",
"integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==" "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA=="
}, },
"node_modules/@hutson/parse-repository-url": { "node_modules/@hutson/parse-repository-url": {
"version": "3.0.2", "version": "3.0.2",
@ -2138,9 +2138,9 @@
} }
}, },
"node_modules/acorn": { "node_modules/acorn": {
"version": "8.10.0", "version": "8.11.3",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz",
"integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==",
"bin": { "bin": {
"acorn": "bin/acorn" "acorn": "bin/acorn"
}, },
@ -4470,16 +4470,16 @@
} }
}, },
"node_modules/flat-cache": { "node_modules/flat-cache": {
"version": "3.1.0", "version": "3.2.0",
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.1.0.tgz", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz",
"integrity": "sha512-OHx4Qwrrt0E4jEIcI5/Xb+f+QmJYNj2rrK8wiIdQOIrB9WrrJL8cjZvXdXuBTkkEwEqLycb5BeZDV1o2i9bTew==", "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==",
"dependencies": { "dependencies": {
"flatted": "^3.2.7", "flatted": "^3.2.9",
"keyv": "^4.5.3", "keyv": "^4.5.3",
"rimraf": "^3.0.2" "rimraf": "^3.0.2"
}, },
"engines": { "engines": {
"node": ">=12.0.0" "node": "^10.12.0 || >=12.0.0"
} }
}, },
"node_modules/flat-cache/node_modules/glob": { "node_modules/flat-cache/node_modules/glob": {
@ -4527,9 +4527,9 @@
} }
}, },
"node_modules/flatted": { "node_modules/flatted": {
"version": "3.2.7", "version": "3.3.1",
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz",
"integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==" "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw=="
}, },
"node_modules/follow-redirects": { "node_modules/follow-redirects": {
"version": "1.15.6", "version": "1.15.6",
@ -6608,9 +6608,9 @@
} }
}, },
"node_modules/keyv": { "node_modules/keyv": {
"version": "4.5.3", "version": "4.5.4",
"resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.3.tgz", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",
"integrity": "sha512-QCiSav9WaX1PgETJ+SpNnx2PRRapJ/oRSXM4VO5OGYGSjrxbKPVFVhB3l2OCbLCk329N8qyAtsJjSjvVBWzEug==", "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==",
"dependencies": { "dependencies": {
"json-buffer": "3.0.1" "json-buffer": "3.0.1"
} }
@ -12586,7 +12586,8 @@
"@babel/eslint-parser": "^7.24.1", "@babel/eslint-parser": "^7.24.1",
"eslint-config-prettier": "^9.1.0", "eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3", "eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-simple-import-sort": "^12.1.0" "eslint-plugin-simple-import-sort": "^12.1.0",
"globals": "^15.0.0"
}, },
"engines": { "engines": {
"node": ">=v18.12.0" "node": ">=v18.12.0"
@ -12596,6 +12597,17 @@
"prettier": ">= 3.2.5" "prettier": ">= 3.2.5"
} }
}, },
"packages/jsdoc-eslint-config/node_modules/globals": {
"version": "15.0.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-15.0.0.tgz",
"integrity": "sha512-m/C/yR4mjO6pXDTm9/R/SpYTAIyaUB4EOzcaaMEl7mds7Mshct9GfejiJNQGjHHbdMPey13Kpu4TMbYi9ex1pw==",
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"packages/jsdoc-parse": { "packages/jsdoc-parse": {
"name": "@jsdoc/parse", "name": "@jsdoc/parse",
"version": "0.3.10", "version": "0.3.10",

View File

@ -14,8 +14,6 @@
limitations under the License. limitations under the License.
*/ */
/* global jsdoc */
import * as astBuilder from '../../../lib/ast-builder.js'; import * as astBuilder from '../../../lib/ast-builder.js';
const { AstBuilder } = astBuilder; const { AstBuilder } = astBuilder;

View File

@ -13,6 +13,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import Engine from '../../index.js'; import Engine from '../../index.js';
import engine from '../../lib/engine.js'; import engine from '../../lib/engine.js';

View File

@ -14,8 +14,6 @@
limitations under the License. limitations under the License.
*/ */
/* global jsdoc */
import EventEmitter from 'node:events'; import EventEmitter from 'node:events';
import path from 'node:path'; import path from 'node:path';

View File

@ -13,6 +13,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import ow from 'ow'; import ow from 'ow';
import { flags, parseFlags } from '../../../lib/flags.js'; import { flags, parseFlags } from '../../../lib/flags.js';

View File

@ -13,4 +13,5 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
// `@jsdoc/cli/lib/help` is tested indirectly by the tests for `@jsdoc/cli/lib/engine`. // `@jsdoc/cli/lib/help` is tested indirectly by the tests for `@jsdoc/cli/lib/engine`.

View File

@ -14,8 +14,6 @@
limitations under the License. limitations under the License.
*/ */
/* global jsdoc */
import EventEmitter from 'node:events'; import EventEmitter from 'node:events';
import path from 'node:path'; import path from 'node:path';

View File

@ -13,6 +13,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import * as name from '../../../lib/name.js'; import * as name from '../../../lib/name.js';
describe('@jsdoc/core.name', () => { describe('@jsdoc/core.name', () => {

View File

@ -13,7 +13,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
/* global jsdoc */
import path from 'node:path'; import path from 'node:path';
import * as plugins from '../../../lib/plugins.js'; import * as plugins from '../../../lib/plugins.js';

View File

@ -13,6 +13,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import doclet from '../../index.js'; import doclet from '../../index.js';
import * as augment from '../../lib/augment.js'; import * as augment from '../../lib/augment.js';
import { resolveBorrows } from '../../lib/borrow.js'; import { resolveBorrows } from '../../lib/borrow.js';

View File

@ -13,7 +13,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
/* global jsdoc */
import * as augment from '../../../lib/augment.js'; import * as augment from '../../../lib/augment.js';
describe('@jsdoc/doclet/lib/augment', () => { describe('@jsdoc/doclet/lib/augment', () => {

View File

@ -13,4 +13,5 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
// TODO: Write tests // TODO: Write tests

View File

@ -13,7 +13,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
/* global jsdoc */
import { name } from '@jsdoc/core'; import { name } from '@jsdoc/core';
import { Doclet } from '../../../lib/doclet.js'; import { Doclet } from '../../../lib/doclet.js';

View File

@ -13,7 +13,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
/* global jsdoc */
import { name } from '@jsdoc/core'; import { name } from '@jsdoc/core';
import _ from 'lodash'; import _ from 'lodash';

View File

@ -14,8 +14,6 @@
limitations under the License. limitations under the License.
*/ */
/* global jsdoc */
import * as jsdocPackage from '../../../lib/package.js'; import * as jsdocPackage from '../../../lib/package.js';
const { Package } = jsdocPackage; const { Package } = jsdocPackage;

View File

@ -13,6 +13,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import * as schema from '../../../lib/schema.js'; import * as schema from '../../../lib/schema.js';
describe('@jsdoc/doclet/lib/schema', () => { describe('@jsdoc/doclet/lib/schema', () => {

View File

@ -13,23 +13,41 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
module.exports = {
extends: ['plugin:prettier/recommended'],
env: { import babelParser from '@babel/eslint-parser';
es6: true, import prettier from 'eslint-plugin-prettier';
jasmine: true, import prettierConfig from 'eslint-plugin-prettier/recommended';
node: true, import simpleImportSort from 'eslint-plugin-simple-import-sort';
import globals from 'globals';
export default [
{
ignores: [
'**/out/',
'**/tmp/',
'coverage/',
'packages/**/static/**',
'packages/**/test/fixtures/**',
],
}, },
{
parser: '@babel/eslint-parser', files: ['**/*.cjs', '**/*.js', '**/*.mjs'],
parserOptions: { languageOptions: {
ecmaVersion: 'latest', ecmaVersion: 'latest',
globals: {
...globals.jasmine,
...globals.node,
},
parser: babelParser,
parserOptions: {
requireConfigFile: false, requireConfigFile: false,
},
sourceType: 'module', sourceType: 'module',
}, },
plugins: ['prettier', 'simple-import-sort'], plugins: {
prettier,
'simple-import-sort': simpleImportSort,
},
rules: { rules: {
// Possible errors // Possible errors
'array-callback-return': 'error', 'array-callback-return': 'error',
@ -237,11 +255,13 @@ module.exports = {
'line-comment-position': 'off', 'line-comment-position': 'off',
'unicode-bom': ['error', 'never'], 'unicode-bom': ['error', 'never'],
// https://github.com/lydell/eslint-plugin-simple-import-sort
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
// https://github.com/prettier/eslint-plugin-prettier // https://github.com/prettier/eslint-plugin-prettier
'prettier/prettier': 'error', 'prettier/prettier': 'error',
// https://github.com/lydell/eslint-plugin-simple-import-sort
'simple-import-sort/exports': 'error',
'simple-import-sort/imports': 'error',
}, },
}; },
prettierConfig,
];

View File

@ -14,7 +14,8 @@
"@babel/eslint-parser": "^7.24.1", "@babel/eslint-parser": "^7.24.1",
"eslint-config-prettier": "^9.1.0", "eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3", "eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-simple-import-sort": "^12.1.0" "eslint-plugin-simple-import-sort": "^12.1.0",
"globals": "^15.0.0"
}, },
"peerDependencies": { "peerDependencies": {
"eslint": ">= 8.57.0", "eslint": ">= 8.57.0",
@ -33,7 +34,12 @@
"bugs": { "bugs": {
"url": "https://github.com/jsdoc/jsdoc/issues" "url": "https://github.com/jsdoc/jsdoc/issues"
}, },
"type": "commonjs", "type": "module",
"exports": {
".": {
"import": "./index.js"
}
},
"engines": { "engines": {
"node": ">=v18.12.0" "node": ">=v18.12.0"
}, },

View File

@ -13,7 +13,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
/* global jsdoc */
import * as handlers from '../../../lib/handlers.js'; import * as handlers from '../../../lib/handlers.js';
describe('@jsdoc/parse/lib/handlers', () => { describe('@jsdoc/parse/lib/handlers', () => {

View File

@ -13,8 +13,9 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
/* eslint-disable no-script-url */ /* eslint-disable no-script-url */
/* global jsdoc */
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';

View File

@ -13,7 +13,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
/* global jsdoc */
import { Parser } from '../../../lib/parser.js'; import { Parser } from '../../../lib/parser.js';
import { Visitor } from '../../../lib/visitor.js'; import { Visitor } from '../../../lib/visitor.js';

View File

@ -13,7 +13,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
/* global jsdoc */
import path from 'node:path'; import path from 'node:path';
import { plugins } from '@jsdoc/core'; import { plugins } from '@jsdoc/core';

View File

@ -13,7 +13,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
/* global jsdoc */
import path from 'node:path'; import path from 'node:path';
import { plugins } from '@jsdoc/core'; import { plugins } from '@jsdoc/core';

View File

@ -13,7 +13,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
/* global jsdoc */
import path from 'node:path'; import path from 'node:path';
import { plugins } from '@jsdoc/core'; import { plugins } from '@jsdoc/core';

View File

@ -13,7 +13,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
/* global jsdoc */
import path from 'node:path'; import path from 'node:path';
import { plugins } from '@jsdoc/core'; import { plugins } from '@jsdoc/core';

View File

@ -13,7 +13,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
/* global jsdoc */
import path from 'node:path'; import path from 'node:path';
import { plugins } from '@jsdoc/core'; import { plugins } from '@jsdoc/core';

View File

@ -13,6 +13,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import * as summarize from '../../summarize.js'; import * as summarize from '../../summarize.js';
describe('summarize', () => { describe('summarize', () => {

View File

@ -13,7 +13,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
/* global jsdoc */
import path from 'node:path'; import path from 'node:path';
import { plugins } from '@jsdoc/core'; import { plugins } from '@jsdoc/core';

View File

@ -13,6 +13,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import tag from '../../index.js'; import tag from '../../index.js';
import definitions from '../../lib/definitions/index.js'; import definitions from '../../lib/definitions/index.js';
import { Dictionary } from '../../lib/dictionary.js'; import { Dictionary } from '../../lib/dictionary.js';

View File

@ -13,6 +13,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import * as definitions from '../../../../lib/definitions/index.js'; import * as definitions from '../../../../lib/definitions/index.js';
describe('@jsdoc/tag/lib/definitions', () => { describe('@jsdoc/tag/lib/definitions', () => {

View File

@ -13,7 +13,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
/* global jsdoc */
import { Dictionary } from '../../../lib/dictionary.js'; import { Dictionary } from '../../../lib/dictionary.js';
describe('@jsdoc/tag/lib/dictionary', () => { describe('@jsdoc/tag/lib/dictionary', () => {

View File

@ -13,6 +13,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import * as inline from '../../../lib/inline.js'; import * as inline from '../../../lib/inline.js';
describe('@jsdoc/tag/lib/inline', () => { describe('@jsdoc/tag/lib/inline', () => {

View File

@ -13,7 +13,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
/* global jsdoc */
import * as jsdocTag from '../../../lib/tag.js'; import * as jsdocTag from '../../../lib/tag.js';
import * as type from '../../../lib/type.js'; import * as type from '../../../lib/type.js';

View File

@ -13,6 +13,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import * as type from '../../../lib/type.js'; import * as type from '../../../lib/type.js';
describe('@jsdoc/tag/lib/type', () => { describe('@jsdoc/tag/lib/type', () => {

View File

@ -14,8 +14,6 @@
limitations under the License. limitations under the License.
*/ */
/* global jsdoc */
import { Tag } from '../../../lib/tag.js'; import { Tag } from '../../../lib/tag.js';
import * as validator from '../../../lib/validator.js'; import * as validator from '../../../lib/validator.js';

View File

@ -14,8 +14,6 @@
limitations under the License. limitations under the License.
*/ */
/* global jsdoc */
import { Env } from '@jsdoc/core'; import { Env } from '@jsdoc/core';
import { Doclet } from '@jsdoc/doclet'; import { Doclet } from '@jsdoc/doclet';
import salty from '@jsdoc/salty'; import salty from '@jsdoc/salty';

View File

@ -13,6 +13,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import util from '../../index.js'; import util from '../../index.js';
import bus from '../../lib/bus.js'; import bus from '../../lib/bus.js';
import cast from '../../lib/cast.js'; import cast from '../../lib/cast.js';

View File

@ -13,6 +13,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import EventEmitter from 'node:events'; import EventEmitter from 'node:events';
import EventBus from '../../../lib/bus.js'; import EventBus from '../../../lib/bus.js';

View File

@ -13,6 +13,7 @@
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import cast from '../../../lib/cast.js'; import cast from '../../../lib/cast.js';
describe('@jsdoc/util/lib/cast', () => { describe('@jsdoc/util/lib/cast', () => {

View File

@ -14,8 +14,6 @@
limitations under the License. limitations under the License.
*/ */
/* global jsdoc */
import getLogFunctions from '../../../lib/log.js'; import getLogFunctions from '../../../lib/log.js';
describe('@jsdoc/util/lib/log', () => { describe('@jsdoc/util/lib/log', () => {