Skip to content

Commit

Permalink
ci: add stricter linting
Browse files Browse the repository at this point in the history
  • Loading branch information
adamalston committed Dec 5, 2024
1 parent 8a03b88 commit 7459238
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,28 +1,40 @@
// @ts-check

import { readdirSync } from 'fs';
import { join } from 'path';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';

import eslint from '@eslint/js';
import perfectionist from 'eslint-plugin-perfectionist';
import tseslint from 'typescript-eslint';

const { dirname } = import.meta;
const baseDir = join(dirname, 'src');
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const baseDir = join(__dirname, 'src');
const internalDirectories = readdirSync(baseDir, {
withFileTypes: true,
}).flatMap((dirent) => (dirent.isDirectory() ? dirent.name : []));

console.log({
__dirname,
importMetaDirname: import.meta.dirname,
equal: __dirname === import.meta.dirname,
});

export default tseslint.config(
eslint.configs.recommended,
tseslint.configs.strictTypeChecked,
tseslint.configs.stylisticTypeChecked,
{
languageOptions: {
parserOptions: { tsconfigRootDir: dirname, projectService: true },
parserOptions: {
tsconfigRootDir: import.meta.dirname,
projectService: true,
},
},
},
{ ignores: ['build', 'deprecated'] },
{ files: ['**/*.mjs'], extends: [tseslint.configs.disableTypeChecked] },
{ ignores: ['build', 'coverage', 'deprecated'] },
{
rules: {
eqeqeq: 'error',
Expand Down

0 comments on commit 7459238

Please sign in to comment.