-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #912 from 3YOURMIND/eslint-plugin-3yourmind/mvp
feature(eslint): add reusable eslint config, create `@3yourmind/eslint-config`
- Loading branch information
Showing
236 changed files
with
3,758 additions
and
2,069 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
// @ts-check | ||
|
||
import tseslint from 'typescript-eslint' | ||
import eslintConfig3YD from '@3yourmind/eslint-config' | ||
import { fileURLToPath } from 'url' | ||
import path from 'node:path' | ||
|
||
/** | ||
* Find the project root in a way that is compatible with most javascript engines (e.g. node, vscode's node, bun) | ||
*/ | ||
const root = (() => { | ||
const cause = [] | ||
|
||
try { | ||
const result = __dirname | ||
if (result) return result | ||
} catch (error) { | ||
cause.push(error) | ||
} | ||
|
||
try { | ||
const result = import.meta.dirname | ||
if (result) return result | ||
} catch (error) { | ||
cause.push(error) | ||
} | ||
|
||
try { | ||
const result = path.dirname(fileURLToPath(import.meta.url)) | ||
if (result) return result | ||
} catch (error) { | ||
cause.push(error) | ||
} | ||
|
||
throw new Error('could not determine project root', { cause }) | ||
})() | ||
|
||
const config = tseslint.config( | ||
/** | ||
* DO NOT ADD ANY OTHER KEYS TO THIS FIRST OBJECT | ||
* | ||
* @see {@link https://eslint.org/docs/latest/use/configure/ignore#ignoring-files} | ||
*/ | ||
{ | ||
ignores: ['**/dist/**', '**/.nuxt/**', '**/.turbo/**', '**/*.js'], | ||
}, | ||
...eslintConfig3YD.configs.global, | ||
{ | ||
languageOptions: { | ||
ecmaVersion: 2022, | ||
parserOptions: { | ||
debugLevel: 'typescript-eslint', | ||
project: [ | ||
'./tsconfig.json', | ||
'./internals/*/tsconfig.json', | ||
'./packages/*/tsconfig.json', | ||
'./packages/kotti-ui/tsconfig.node.json', | ||
], | ||
tsconfigRootDir: root, | ||
}, | ||
sourceType: 'module', | ||
}, | ||
}, | ||
...eslintConfig3YD.configs.default.map((config) => ({ | ||
...config, | ||
files: ['packages/**/*.ts', 'packages/**/*.tsx'], | ||
})), | ||
...eslintConfig3YD.configs.untyped, | ||
...eslintConfig3YD.configs.json, | ||
...eslintConfig3YD.configs.tests.map((config) => ({ | ||
...config, | ||
files: [...config.files, 'packages/kotti-ui/source/test-utils/**/*.ts'], | ||
})), | ||
...eslintConfig3YD.configs.vue, | ||
{ | ||
rules: { | ||
'@typescript-eslint/no-restricted-imports': [ | ||
'error', | ||
{ | ||
message: | ||
"Avoid direct imports from lodash; e.g. import foo from 'lodash/foo' instead of import { foo } from 'lodash'", | ||
name: 'lodash', | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
files: ['packages/kotti-ui/source/*/index.ts'], | ||
rules: { | ||
'@typescript-eslint/naming-convention': 'off', | ||
}, | ||
}, | ||
) | ||
|
||
export default config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,3 @@ | ||
# `@3yourmind/documentation` | ||
|
||
> TODO: description | ||
## Usage | ||
|
||
``` | ||
const documentation = require('@3yourmind/documentation'); | ||
// TODO: DEMONSTRATE API | ||
``` |
Oops, something went wrong.