Skip to content

Commit

Permalink
chore: reconfigure ESLint using flat config
Browse files Browse the repository at this point in the history
  • Loading branch information
robertrossmann committed Oct 6, 2024
1 parent b0e6658 commit 6edc434
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 56 deletions.
42 changes: 0 additions & 42 deletions .eslintrc.js

This file was deleted.

57 changes: 57 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -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<import("eslint").Linter.FlatConfig>} */
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
2 changes: 0 additions & 2 deletions src/bin/generate.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -12,7 +11,6 @@ if (!entrypoint || !outfile) {
throw new Error('Usage: generate <entrypoint> <outfile>')
}

// 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`
Expand Down
1 change: 0 additions & 1 deletion src/bin/refresh-package.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable import/no-unused-modules */
import 'source-map-support/register'
import 'tsconfig-paths/register'
import * as fs from 'fs'
Expand Down
4 changes: 2 additions & 2 deletions src/generators/mktokens/tokens/InputParams.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { CodePalette, ColourPalette } from '@remedy/types'
import { type CodePalette, type ColourPalette } from '@remedy/types'

interface InputParams {
code: CodePalette
colours: ColourPalette
}

export {
InputParams
InputParams,
}
16 changes: 8 additions & 8 deletions src/types/UIColourPalette.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable max-len */
/* eslint-disable @stylistic/max-len */
import type * as Color from 'color'

type ColourLike = Color | string
Expand Down Expand Up @@ -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. */
Expand Down Expand Up @@ -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. */
Expand Down Expand Up @@ -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. */
Expand Down Expand Up @@ -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. */
Expand Down Expand Up @@ -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. */
Expand Down
1 change: 0 additions & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-unused-modules
export * from './VSCTheme'
export * from './UIColourPalette'
export * from './CodePalette'
Expand Down

0 comments on commit 6edc434

Please sign in to comment.