Skip to content

Commit

Permalink
chore: eslint v9
Browse files Browse the repository at this point in the history
  • Loading branch information
imranbarbhuiya committed Nov 28, 2024
1 parent 64145ec commit 9566ae9
Show file tree
Hide file tree
Showing 24 changed files with 797 additions and 1,326 deletions.
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

8 changes: 0 additions & 8 deletions .eslintrc.json

This file was deleted.

3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.yarn
.yarn
CHANGELOG.md
160 changes: 80 additions & 80 deletions .yarn/releases/yarn-4.5.2.cjs → .yarn/releases/yarn-4.5.3.cjs
100755 → 100644

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ enableGlobalCache: true

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.5.2.cjs
yarnPath: .yarn/releases/yarn-4.5.3.cjs
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

## Features

- Written In Typescript
- Offers CLI and API
- Full TypeScript & JavaScript support
- Framework agnostic
- Supports Pluralization
- Fully customizable
- Supports dynamic keys using typescript const types
- Written In Typescript
- Offers CLI and API
- Full TypeScript & JavaScript support
- Framework agnostic
- Supports Pluralization
- Fully customizable
- Supports dynamic keys using typescript const types

## Usage

Expand Down Expand Up @@ -133,14 +133,14 @@ If you want to support me by donating, you can do so by using any of the followi
## TODO
- [ ] Write unit tests
- [ ] Add support for `yaml`, `json5` translation files
- [ ] Add support for other framework specific source files (e.g. `vue`, `svelte`, `angular` etc.)
- [ ] Detect unused translation keys
- [ ] A vscode extension
- [ ] A github action
- [ ] An eslint plugin
- [ ] A `--fix` flag to remove unused keys and variables
- [ ] Write unit tests
- [ ] Add support for `yaml`, `json5` translation files
- [ ] Add support for other framework specific source files (e.g. `vue`, `svelte`, `angular` etc.)
- [ ] Detect unused translation keys
- [ ] A vscode extension
- [ ] A github action
- [ ] An eslint plugin
- [ ] A `--fix` flag to remove unused keys and variables
_Any help to complete these tasks will be highly appreciated._
Expand Down
15 changes: 15 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import common from 'eslint-config-mahir/common';
import node from 'eslint-config-mahir/node';
import typescript from 'eslint-config-mahir/typescript';

/**
* @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.ConfigArray}
*/
export default [
...common,
...node,
...typescript,
{
ignores: ['node_modules/', '.github', '.yarn', '**/dist']
}
];
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"packages/*"
],
"scripts": {
"lint": "turbo run lint",
"lint": "TIMING=1 turbo run lint",
"format": "prettier --write --cache .",
"test": "turbo run test",
"test:watch": "turbo run test:watch",
Expand All @@ -21,18 +21,18 @@
"@commitlint/config-conventional": "^19.6.0",
"@favware/cliff-jumper": "^5.0.0",
"@favware/npm-deprecate": "^2.0.0",
"@types/node": "^22.9.3",
"@vitest/coverage-v8": "^2.1.5",
"@types/node": "^22.10.1",
"@vitest/coverage-v8": "^2.1.6",
"cz-conventional-changelog": "^3.3.0",
"esbuild-plugin-version-injector": "^1.2.1",
"eslint": "^9.13.0",
"eslint-config-mahir": "^1.0.4",
"eslint": "^9.15.0",
"eslint-config-mahir": "^1.0.6",
"husky": "^9.1.7",
"lint-staged": "^15.2.10",
"prettier": "^3.3.3",
"prettier": "^3.4.1",
"tsup": "^8.3.5",
"turbo": "^2.3.1",
"vitest": "^2.1.5"
"turbo": "^2.3.3",
"vitest": "^2.1.6"
},
"commitlint": {
"extends": [
Expand All @@ -51,5 +51,5 @@
"ansi-regex": "^5.0.1",
"minimist": "^1.2.8"
},
"packageManager": "[email protected].2"
"packageManager": "[email protected].3"
}
13 changes: 0 additions & 13 deletions packages/action/.eslintrc.json

This file was deleted.

6 changes: 3 additions & 3 deletions packages/action/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

## Features

- Provides problem matcher for GitHub Actions
- Fully customizable
- Easy to use
- Provides problem matcher for GitHub Actions
- Fully customizable
- Easy to use

## Usage

Expand Down
20 changes: 20 additions & 0 deletions packages/action/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import rootConfig from '../../eslint.config.mjs';

/**
* @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.ConfigArray}
*/
export default [
...rootConfig,
{
rules: {
'n/hashbang': [
'error',
{
convertPath: {
'src/**/*.ts': ['^src/(.+?)\\.ts$', 'dist/$1.js']
}
}
]
}
}
];
4 changes: 0 additions & 4 deletions packages/action/tsconfig.eslint.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/action/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "../../tsconfig.base.json"
"extends": "../../tsconfig.json"
}
13 changes: 0 additions & 13 deletions packages/core/.eslintrc.json

This file was deleted.

14 changes: 7 additions & 7 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@

## Features

- Written In Typescript
- Offers CLI and API
- Full TypeScript & JavaScript support
- Framework agnostic
- Supports Pluralization
- Fully customizable
- Supports dynamic keys using typescript const types
- Written In Typescript
- Offers CLI and API
- Full TypeScript & JavaScript support
- Framework agnostic
- Supports Pluralization
- Fully customizable
- Supports dynamic keys using typescript const types

## Usage

Expand Down
20 changes: 20 additions & 0 deletions packages/core/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import rootConfig from '../../eslint.config.mjs';

/**
* @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.ConfigArray}
*/
export default [
...rootConfig,
{
rules: {
'n/hashbang': [
'error',
{
convertPath: {
'src/**/*.ts': ['^src/(.+?)\\.ts$', 'dist/$1.js']
}
}
]
}
}
];
16 changes: 8 additions & 8 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "i18n-validate",
"version": "1.4.4",
"version": "1.4.5",
"description": "A cli tool to find invalid i18n keys, missing variables and many more",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand All @@ -10,7 +10,7 @@
"license": "MIT",
"author": "@imranbarbhuiya",
"scripts": {
"lint": "eslint src tests --fix --cache",
"lint": "eslint . --cache",
"test": "vitest run",
"test:watch": "vitest",
"build": "tsup",
Expand All @@ -36,16 +36,16 @@
"devDependencies": {
"@favware/cliff-jumper": "^5.0.0",
"@favware/npm-deprecate": "^2.0.0",
"@types/node": "^22.9.3",
"@vitest/coverage-v8": "^2.1.5",
"@types/node": "^22.10.1",
"@vitest/coverage-v8": "^2.1.6",
"esbuild-plugin-version-injector": "^1.2.1",
"eslint": "^9.13.0",
"eslint-config-mahir": "^1.0.4",
"eslint": "^9.15.0",
"eslint-config-mahir": "^1.0.6",
"husky": "^9.1.7",
"lint-staged": "^15.2.10",
"prettier": "^3.3.3",
"prettier": "^3.4.1",
"tsup": "^8.3.5",
"vitest": "^2.1.5"
"vitest": "^2.1.6"
},
"files": [
"dist/**/*.js*",
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env node

import process from 'node:process';

import { Command } from 'commander';
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/validateKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const validateKey = async (node: TranslationNode, options: OptionsWithDef
const { default: json }: { default: Record<string, unknown> | null } = await importLocaleFile(url, options).catch(() => ({ default: null }));

if (!json) {
log(new ValidationError(`Invalid locale file: ${filePath}`, node.path, node.positions), 'error', options);
log(new ValidationError(`Invalid locale file: ${url}`, node.path, node.positions), 'error', options);

return false;
}
Expand Down
4 changes: 0 additions & 4 deletions packages/core/tsconfig.eslint.json

This file was deleted.

2 changes: 1 addition & 1 deletion packages/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "../../tsconfig.base.json"
"extends": "../../tsconfig.json"
}
10 changes: 0 additions & 10 deletions tsconfig.eslint.json

This file was deleted.

13 changes: 8 additions & 5 deletions tsconfig.base.json → tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "esnext",
"module": "node16",
"module": "preserve",
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
Expand All @@ -11,12 +11,15 @@
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"moduleResolution": "node16",
"lib": ["es2021"],
"moduleResolution": "bundler",
"lib": ["esnext"],
"declaration": true,
"outDir": "dist",
"esModuleInterop": true,
"skipLibCheck": true
"skipLibCheck": true,
"noEmit": true,
"emitDeclarationOnly": true,
"allowJs": true
},
"includes": ["src/**/*.ts"]
"includes": ["src/**/*.ts", "eslint.config.mjs", "tsup.config.ts", "vitest.config.ts"]
}
Loading

0 comments on commit 9566ae9

Please sign in to comment.