diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 20faf84..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict' - -const rules = { - // If your editor cannot show these to you, occasionally turn this off and run the linter - 'no-warning-comments': 0, - 'max-len': ['warn', 120], -} - -/** @type {import("eslint").Linter.Config} */ -module.exports = { - reportUnusedDisableDirectives: true, - ignorePatterns: [ - 'samples', - '*.js', - '*.d.ts', - '!.*.js', - '!*.config.js', - 'node_modules', - ], - - extends: [ - '@strv/node/v20', - '@strv/node/optional', - '@strv/node/style', - ], - rules, - - overrides: [{ - files: ['**/*.ts', '**/*.mts'], - extends: [ - '@strv/node/v20', - '@strv/node/optional', - '@strv/node/style', - '@strv/typescript', - '@strv/typescript/style', - ], - parserOptions: { - project: './tsconfig.json', - }, - rules, - }], -} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..2e3f0b1 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,57 @@ +import node from '@strv/eslint-config-node' +import nodeopt from '@strv/eslint-config-node/optional' +import nodestyle from '@strv/eslint-config-node/style' +import ts from '@strv/eslint-config-typescript' +import tsopt from '@strv/eslint-config-typescript/optional' +import tsstyle from '@strv/eslint-config-typescript/style' + +const globs = { + js: '**/*.js', + mjs: '**/*.mjs', + ts: '**/*.ts', + dts: '**/*.d.ts', +} + +/** @type {Array} */ +const config = [ + { linterOptions: { + reportUnusedDisableDirectives: true, + } }, + + { files: [globs.ts, globs.dts, globs.mjs], ...node }, + { files: [globs.ts, globs.dts, globs.mjs], ...nodeopt }, + { files: [globs.ts, globs.dts, globs.mjs], ...nodestyle }, + + { files: [globs.ts, globs.dts], ...ts }, + { files: [globs.ts, globs.dts], ...tsopt }, + { files: [globs.ts, globs.dts], ...tsstyle }, + + { files: [globs.ts, globs.dts], + languageOptions: { + parserOptions: { project: './tsconfig.json' }, + }, + rules: {} }, + + { files: [globs.ts, globs.dts, globs.mjs], + rules: { + // We depend on TypeScript to catch unresolved module paths + 'import/no-unresolved': 'off', + 'import/no-extraneous-dependencies': ['error', { + devDependencies: [ + globs.ts, + globs.dts, + globs.mjs, + globs.js, + ], + }], + } }, + { + ignores: [ + globs.js, + 'node_modules', + 'samples', + ], + }, +] + +export default config diff --git a/src/bin/generate.ts b/src/bin/generate.ts index 1b61dc7..18d5ed8 100644 --- a/src/bin/generate.ts +++ b/src/bin/generate.ts @@ -1,4 +1,3 @@ -/* eslint-disable import/no-unused-modules */ import 'source-map-support/register' import 'tsconfig-paths/register' import * as fs from 'fs/promises' @@ -12,7 +11,6 @@ if (!entrypoint || !outfile) { throw new Error('Usage: generate ') } -// eslint-disable-next-line node/no-unsupported-features/es-syntax import(path.resolve(process.cwd(), entrypoint)) .then(async ({ default: theme }: { default: VSCTheme }) => { const data = `${JSON.stringify(theme, null, 2)}\n` diff --git a/src/bin/refresh-package.ts b/src/bin/refresh-package.ts index 42162bb..2fc1498 100644 --- a/src/bin/refresh-package.ts +++ b/src/bin/refresh-package.ts @@ -1,4 +1,3 @@ -/* eslint-disable import/no-unused-modules */ import 'source-map-support/register' import 'tsconfig-paths/register' import * as fs from 'fs' diff --git a/src/generators/mktokens/tokens/InputParams.d.ts b/src/generators/mktokens/tokens/InputParams.d.ts index 8ffa96f..2bc762a 100644 --- a/src/generators/mktokens/tokens/InputParams.d.ts +++ b/src/generators/mktokens/tokens/InputParams.d.ts @@ -1,4 +1,4 @@ -import type { CodePalette, ColourPalette } from '@remedy/types' +import { type CodePalette, type ColourPalette } from '@remedy/types' interface InputParams { code: CodePalette @@ -6,5 +6,5 @@ interface InputParams { } export { - InputParams + InputParams, } diff --git a/src/types/UIColourPalette.ts b/src/types/UIColourPalette.ts index 02d2653..df5d968 100644 --- a/src/types/UIColourPalette.ts +++ b/src/types/UIColourPalette.ts @@ -1,4 +1,4 @@ -/* eslint-disable max-len */ +/* eslint-disable @stylistic/max-len */ import type * as Color from 'color' type ColourLike = Color | string @@ -146,9 +146,9 @@ interface UIColourPalette { /** Icon color for unresolved comments. */ 'commentsView.unresolvedIcon'?: ColourLike /** An extra border around active elements to separate them from others for greater contrast. */ - 'contrastActiveBorder'?: ColourLike + contrastActiveBorder?: ColourLike /** An extra border around elements to separate them from others for greater contrast. */ - 'contrastBorder'?: ColourLike + contrastBorder?: ColourLike /** Foreground color for error messages in debug REPL console. */ 'debugConsole.errorForeground'?: ColourLike /** Foreground color for info messages in debug REPL console. */ @@ -222,7 +222,7 @@ interface UIColourPalette { /** Color used to highlight value changes in the debug views (such as in the Variables view). */ 'debugView.valueChangedHighlight'?: ColourLike /** Foreground color for description text providing additional information, for example for a label. */ - 'descriptionForeground'?: ColourLike + descriptionForeground?: ColourLike /** Border color between the two text editors. */ 'diffEditor.border'?: ColourLike /** Color of the diff editor's diagonal fill. The diagonal fill is used in side-by-side diff views. */ @@ -260,7 +260,7 @@ interface UIColourPalette { /** Diff overview ruler foreground for removed content. */ 'diffEditorOverview.removedForeground'?: ColourLike /** Overall foreground for disabled elements. This color is only used if not overridden by a component. */ - 'disabledForeground'?: ColourLike + disabledForeground?: ColourLike /** Dropdown background. */ 'dropdown.background'?: ColourLike /** Dropdown border. */ @@ -662,7 +662,7 @@ interface UIColourPalette { /** Border color of the resize bar of editor widgets. The color is only used if the widget chooses to have a resize border and if the color is not overridden by a widget. */ 'editorWidget.resizeBorder'?: ColourLike /** Overall foreground color for error messages (this color is only used if not overridden by a component). */ - 'errorForeground'?: ColourLike + errorForeground?: ColourLike /** Background color for the remote badge in the extensions view. */ 'extensionBadge.remoteBackground'?: ColourLike /** Foreground color for the remote badge in the extensions view. */ @@ -690,9 +690,9 @@ interface UIColourPalette { /** The icon color for extension verified publisher. */ 'extensionIcon.verifiedForeground'?: ColourLike /** Overall border color for focused elements. This color is only used if not overridden by a component. */ - 'focusBorder'?: ColourLike + focusBorder?: ColourLike /** Overall foreground color. This color is only used if not overridden by a component. */ - 'foreground'?: ColourLike + foreground?: ColourLike /** Color for added Git resources. Used for file labels and the SCM viewlet. */ 'gitDecoration.addedResourceForeground'?: ColourLike /** Color for conflicting Git resources. Used for file labels and the SCM viewlet. */ diff --git a/src/types/index.ts b/src/types/index.ts index 46dd7b0..186b05e 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,4 +1,3 @@ -// eslint-disable-next-line import/no-unused-modules export * from './VSCTheme' export * from './UIColourPalette' export * from './CodePalette'