Skip to content

Commit

Permalink
feat: migrate to eslint flat config
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiefORZ committed Jun 14, 2024
1 parent 50a6696 commit 80e1b38
Show file tree
Hide file tree
Showing 11 changed files with 2,303 additions and 4,814 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"eslint.experimental.useFlatConfig": true
}
14 changes: 4 additions & 10 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/1.4.0/schema.json",
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
Expand All @@ -20,20 +20,14 @@
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 100,
"ignore": [
"**/.next",
"**/.wireit",
"**/build",
"**/dist",
"**/node_modules"
]
"ignore": ["**/.next", "**/.wireit", "**/build", "**/dist", "**/node_modules"]
},
"javascript": {
"formatter": {
"enabled": true,
"quoteStyle": "single",
"arrowParentheses": "always",
"trailingComma": "all",
"trailingCommas": "all",
"lineEnding": "lf"
}
},
Expand All @@ -42,4 +36,4 @@
"enabled": true
}
}
}
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
"husky": "^9.0.11",
"is-ci": "^3.0.1",
"release-it": "^16.3.0"
}
},
"packageManager": "[email protected]+sha512.98a80fd11c2e7096747762304106432b3ddc67dcf54b5a8c01c93f68a2cd5e05e6821849522a06fb76284d41a2660d5e334f2ee3bbf29183bf2e739b1dafa771"
}
4 changes: 2 additions & 2 deletions packages/biome-config/lib/biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/1.4.0/schema.json",
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
Expand Down Expand Up @@ -27,7 +27,7 @@
"enabled": true,
"quoteStyle": "single",
"arrowParentheses": "always",
"trailingComma": "all",
"trailingCommas": "all",
"lineEnding": "lf"
}
},
Expand Down
71 changes: 0 additions & 71 deletions packages/eslint-config-tslint-base/lib/tslint-config.js

This file was deleted.

108 changes: 108 additions & 0 deletions packages/eslint-config-tslint-base/lib/tslint-config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { fixupPluginRules } from '@eslint/compat';
import { FlatCompat } from '@eslint/eslintrc';
import js from '@eslint/js';
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import _import from 'eslint-plugin-import';
import jsonFiles from 'eslint-plugin-json-files';
import sortKeysFix from 'eslint-plugin-sort-keys-fix';
import globals from 'globals';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
{
ignores: ['**/.eslintrc.js'],
},
...compat.extends('eslint:recommended', 'plugin:eslint-comments/recommended'),
{
plugins: {
'@typescript-eslint': typescriptEslint,
'sort-keys-fix': sortKeysFix,
import: fixupPluginRules(_import),
},

languageOptions: {
globals: {
...globals.node,
},

parser: tsParser,
ecmaVersion: 2020,
sourceType: 'module',

parserOptions: {
project: ['./tsconfig.json'],
},
},
},
...compat
.extends(
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
)
.map((config) => ({
...config,
files: ['**/*.ts'],
})),
{
files: ['**/*.ts'],
rules: {
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/indent': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
'@typescript-eslint/no-unsafe-argument': 'warn',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/restrict-plus-operands': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'eslint-comments/disable-enable-pair': 'error',
'eslint-comments/no-aggregating-enable': 'error',
'eslint-comments/no-duplicate-disable': 'error',
'eslint-comments/no-unlimited-disable': 'error',
'eslint-comments/no-unused-disable': 'error',
'eslint-comments/no-unused-enable': 'error',
'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-duplicates': 'error',
'no-empty': 'off',
'no-useless-escape': 'off',
'sort-keys-fix/sort-keys-fix': 'warn',
},
},
{
files: ['**/*.json'],
plugins: {
'json-files': jsonFiles,
},
rules: {
'json-files/require-engines': 'warn',
'json-files/require-license': 'warn',
'json-files/require-unique-dependency-names': 'error',
'json-files/sort-package-json': 'warn',
},
},
];
22 changes: 12 additions & 10 deletions packages/eslint-config-tslint-base/package.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
{
"name": "@chieforz/eslint-config-tslint-base",
"version": "1.2.6",
"keywords": [
"tslint",
"tslint-config",
"tslint config"
],
"keywords": ["tslint", "tslint-config", "tslint config"],
"repository": {
"type": "git",
"url": "https://github.com/ChiefORZ/tslint-config"
},
"license": "MIT",
"author": "ChiefORZ <[email protected]>",
"main": "lib/tslint-config.js",
"type": "module",
"exports": {
".": "./lib/tslint-config.mjs"
},
"main": "lib/tslint-config.mjs",
"directories": {
"lib": "lib"
},
"files": [
"lib"
],
"files": ["lib"],
"dependencies": {
"@eslint/compat": "^1.0.3",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.4.0",
"@typescript-eslint/eslint-plugin": "^7.7.1",
"@typescript-eslint/eslint-plugin-tslint": "^7.0.2",
"@typescript-eslint/parser": "^7.7.1",
Expand All @@ -29,10 +30,11 @@
"eslint-plugin-json-files": "^4.2.0",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-sort-keys-fix": "^1.1.2",
"globals": "^15.4.0",
"typescript": "^5.4.5"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
}
}
}
100 changes: 0 additions & 100 deletions packages/eslint-config-tslint-react/lib/tslint-config-react.js

This file was deleted.

Loading

0 comments on commit 80e1b38

Please sign in to comment.