@santi020k/eslint-config-basic 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/README.md +2 -272
  2. package/dist/index.d.ts +21 -0
  3. package/dist/index.js +127 -0
  4. package/package.json +47 -50
  5. package/.agent/rules/context.md +0 -78
  6. package/.agent/rules/guidelines.md +0 -124
  7. package/.editorconfig +0 -13
  8. package/.env.example +0 -8
  9. package/.github/CODEOWNERS +0 -2
  10. package/.github/DISCUSSION_TEMPLATE/rfcs.yml +0 -21
  11. package/.github/DISCUSSION_TEMPLATE/technical-discussions.yml +0 -21
  12. package/.github/FUNDING.yml +0 -2
  13. package/.github/ISSUE_TEMPLATE/README.md +0 -13
  14. package/.github/ISSUE_TEMPLATE/bug_report.yml +0 -69
  15. package/.github/ISSUE_TEMPLATE/config.yml +0 -8
  16. package/.github/ISSUE_TEMPLATE/feature_request.yml +0 -43
  17. package/.github/ISSUE_TEMPLATE/question.yml +0 -22
  18. package/.github/SECURITY.md +0 -12
  19. package/.github/SPONSORSHIPS.md +0 -27
  20. package/.github/dependabot.yml +0 -45
  21. package/.github/labeler.yml +0 -46
  22. package/.github/pull_request_template.md +0 -56
  23. package/.github/workflows/assign-issues.yml +0 -18
  24. package/.github/workflows/audit.yml +0 -22
  25. package/.github/workflows/build.yml +0 -29
  26. package/.github/workflows/codeql.yml +0 -40
  27. package/.github/workflows/docs.yml +0 -49
  28. package/.github/workflows/labeler.yml +0 -18
  29. package/.github/workflows/publish.yml +0 -24
  30. package/.github/workflows/release.yml +0 -35
  31. package/.github/workflows/size-check.yml +0 -23
  32. package/.github/workflows/stale.yml +0 -31
  33. package/.nvmrc +0 -1
  34. package/.vscode/extensions.json +0 -10
  35. package/.vscode/settings.json +0 -55
  36. package/CHANGELOG.md +0 -16
  37. package/CONTRIBUTING.md +0 -194
  38. package/DEVELOPMENT.md +0 -4
  39. package/LICENSE +0 -21
  40. package/config/.husky/commit-msg +0 -9
  41. package/config/.husky/pre-commit +0 -1
  42. package/config/.husky/pre-push +0 -1
  43. package/config/.husky/prepare-commit-msg +0 -1
  44. package/cspell.config.yaml +0 -2
  45. package/eslint.config.js +0 -21
  46. package/llms.txt +0 -72
  47. package/packages/astro/README.md +0 -13
  48. package/packages/astro/package.json +0 -45
  49. package/packages/astro/src/ambient.d.ts +0 -10
  50. package/packages/astro/src/index.ts +0 -18
  51. package/packages/astro/src/rules.ts +0 -29
  52. package/packages/astro/tsconfig.json +0 -9
  53. package/packages/astro/tsup.config.ts +0 -11
  54. package/packages/basic/README.md +0 -33
  55. package/packages/basic/package.json +0 -55
  56. package/packages/basic/src/index.ts +0 -110
  57. package/packages/basic/tsconfig.json +0 -9
  58. package/packages/basic/tsup.config.ts +0 -18
  59. package/packages/core/README.md +0 -14
  60. package/packages/core/index.ts +0 -14
  61. package/packages/core/package.json +0 -61
  62. package/packages/core/src/ambient.d.ts +0 -61
  63. package/packages/core/src/index.ts +0 -75
  64. package/packages/core/src/rules.ts +0 -157
  65. package/packages/core/src/settings/gitignore.ts +0 -10
  66. package/packages/core/src/settings/index.ts +0 -1
  67. package/packages/core/src/types.ts +0 -57
  68. package/packages/core/src/utils/index.ts +0 -28
  69. package/packages/core/tsconfig.json +0 -9
  70. package/packages/core/tsup.config.ts +0 -10
  71. package/packages/expo/README.md +0 -13
  72. package/packages/expo/package.json +0 -48
  73. package/packages/expo/src/ambient.d.ts +0 -3
  74. package/packages/expo/src/index.ts +0 -39
  75. package/packages/expo/tsconfig.json +0 -9
  76. package/packages/expo/tsup.config.ts +0 -11
  77. package/packages/nest/package.json +0 -45
  78. package/packages/nest/src/ambient.d.ts +0 -14
  79. package/packages/nest/src/index.ts +0 -20
  80. package/packages/nest/src/rules.ts +0 -15
  81. package/packages/nest/tsconfig.json +0 -9
  82. package/packages/nest/tsup.config.ts +0 -11
  83. package/packages/next/README.md +0 -13
  84. package/packages/next/package.json +0 -47
  85. package/packages/next/src/index.ts +0 -31
  86. package/packages/next/src/rules.ts +0 -16
  87. package/packages/next/tsconfig.json +0 -9
  88. package/packages/next/tsup.config.ts +0 -10
  89. package/packages/optionals/README.md +0 -18
  90. package/packages/optionals/package.json +0 -55
  91. package/packages/optionals/src/ambient.d.ts +0 -25
  92. package/packages/optionals/src/cspell.ts +0 -14
  93. package/packages/optionals/src/i18next.ts +0 -19
  94. package/packages/optionals/src/index.ts +0 -8
  95. package/packages/optionals/src/markdown.ts +0 -66
  96. package/packages/optionals/src/mdx.ts +0 -40
  97. package/packages/optionals/src/stencil.ts +0 -48
  98. package/packages/optionals/src/tailwind.ts +0 -11
  99. package/packages/optionals/src/vitest.ts +0 -61
  100. package/packages/optionals/tsconfig.json +0 -9
  101. package/packages/optionals/tsup.config.ts +0 -11
  102. package/packages/playground/README.md +0 -14
  103. package/packages/playground/package.json +0 -17
  104. package/packages/playground/src/astro/eslint.config.js +0 -4
  105. package/packages/playground/src/js/eslint.config.js +0 -4
  106. package/packages/playground/src/js/index.test.js +0 -63
  107. package/packages/playground/src/mdx/eslint.config.js +0 -4
  108. package/packages/playground/src/mdx/index.mdx +0 -115
  109. package/packages/playground/src/react/eslint.config.js +0 -4
  110. package/packages/playground/src/react/index.test.jsx +0 -130
  111. package/packages/playground/src/ts/eslint.config.js +0 -4
  112. package/packages/playground/src/ts/index.test.ts +0 -61
  113. package/packages/playground/src/ts/tsconfig.json +0 -3
  114. package/packages/playground/tsconfig.json +0 -9
  115. package/packages/react/README.md +0 -14
  116. package/packages/react/index.ts +0 -26
  117. package/packages/react/package.json +0 -49
  118. package/packages/react/src/ambient.d.ts +0 -23
  119. package/packages/react/src/index.ts +0 -52
  120. package/packages/react/src/rules.ts +0 -47
  121. package/packages/react/tsconfig.json +0 -9
  122. package/packages/react/tsup.config.ts +0 -10
  123. package/packages/tests/README.md +0 -17
  124. package/packages/tests/package.json +0 -21
  125. package/packages/tests/src/__snapshots__/snapshots.test.ts.snap +0 -654
  126. package/packages/tests/src/composition.test.ts +0 -171
  127. package/packages/tests/src/configs.test.ts +0 -118
  128. package/packages/tests/src/rules.test.ts +0 -60
  129. package/packages/tests/src/snapshots.test.ts +0 -126
  130. package/packages/tests/tsconfig.json +0 -10
  131. package/packages/tests/vitest.config.ts +0 -8
  132. package/packages/typescript/README.md +0 -14
  133. package/packages/typescript/package.json +0 -47
  134. package/packages/typescript/src/index.ts +0 -32
  135. package/packages/typescript/src/rules.ts +0 -36
  136. package/packages/typescript/tsconfig.json +0 -9
  137. package/packages/typescript/tsup.config.ts +0 -10
  138. package/tsconfig.base.json +0 -20
  139. package/tsconfig.docs.json +0 -18
  140. package/turbo.json +0 -19
  141. package/typedoc.config.mjs +0 -25
  142. package/typedoc.markdown.mjs +0 -26
@@ -1,130 +0,0 @@
1
- import React, {
2
- useCallback,
3
- useEffect,
4
- useMemo,
5
- useRef,
6
- useState
7
- } from 'react'
8
-
9
- // Helper function to simulate fetching data
10
- const fetchTodos = () => new Promise(resolve => {
11
- setTimeout(() => {
12
- resolve([
13
- { id: 1, text: 'Learn React', completed: true },
14
- {
15
- id: 2,
16
- text: 'Build a Todo App',
17
- completed: false
18
- },
19
- { id: 3, text: 'Profit!', completed: false }
20
- ])
21
- }, 1000)
22
- })
23
-
24
- const TodoApp = () => {
25
- const [todos, setTodos] = useState([])
26
- const [filter, setFilter] = useState('all')
27
- const [sortOrder, setSortOrder] = useState('asc')
28
- const inputRef = useRef()
29
-
30
- // Fetch todos when the component mounts
31
- useEffect(() => {
32
- const loadTodos = async () => {
33
- const fetchedTodos = await fetchTodos()
34
-
35
- setTodos(fetchedTodos)
36
- }
37
-
38
- loadTodos()
39
- }, [todos])
40
-
41
- // Handle adding a new todo
42
- const addTodo = useCallback(() => {
43
- const text = inputRef.current.value.trim()
44
-
45
- if (text) {
46
- setTodos(prevTodos => [
47
- ...prevTodos,
48
- { id: Date.now(), text, completed: false }
49
- ])
50
-
51
- inputRef.current.value = ''
52
- }
53
- }, [])
54
-
55
- // Handle toggling the completion state of a todo
56
- const toggleTodo = useCallback(id => {
57
- setTodos(prevTodos => prevTodos.map(todo => todo.id === id ? { ...todo, completed: !todo.completed } : todo))
58
- }, [])
59
-
60
- // Handle changing the filter state
61
- const handleFilterChange = useCallback(event => {
62
- setFilter(event.target.value)
63
- }, [])
64
-
65
- // Handle changing the sort order
66
- const handleSortChange = useCallback(event => {
67
- setSortOrder(event.target.value)
68
- }, [])
69
-
70
- // Filter and sort todos based on current state
71
- const filteredAndSortedTodos = useMemo(() => {
72
- const filteredTodos = todos.filter(todo => {
73
- if (filter === 'completed') return todo.completed
74
-
75
- if (filter === 'incomplete') return !todo.completed
76
-
77
- return true
78
- })
79
-
80
- return filteredTodos.sort((a, b) => {
81
- if (sortOrder === 'asc') return a.text.localeCompare(b.text)
82
-
83
- return b.text.localeCompare(a.text)
84
- })
85
- }, [todos, filter, sortOrder])
86
-
87
- return (
88
- <div>
89
- <h1>Todo List</h1>
90
- <div>
91
- <input ref={inputRef} type="text" placeholder="New todo" />
92
- <button type="button" onClick={addTodo}>
93
- Add Todo
94
- </button>
95
- </div>
96
- <div>
97
- <label>
98
- Filter:
99
- <select value={filter} onChange={handleFilterChange}>
100
- <option value="all">All</option>
101
- <option value="completed">Completed</option>
102
- <option value="incomplete">Incomplete</option>
103
- </select>
104
- </label>
105
- <label>
106
- Sort:
107
- <select value={sortOrder} onChange={handleSortChange}>
108
- <option value="asc">Ascending</option>
109
- <option value="desc">Descending</option>
110
- </select>
111
- </label>
112
- </div>
113
- <ul>
114
- {filteredAndSortedTodos.map(todo => (
115
- <li
116
- key={todo.id}
117
- style={{ textDecoration: todo.completed ? 'line-through' : 'none' }}
118
- >
119
- {todo.text}
120
- <button type="button" onClick={() => toggleTodo(todo.id)}>
121
- {todo.completed ? 'Undo' : 'Complete'}
122
- </button>
123
- </li>
124
- ))}
125
- </ul>
126
- </div>
127
- )
128
- }
129
-
130
- export default TodoApp
@@ -1,4 +0,0 @@
1
- // @ts-check
2
- import { ConfigOption, eslintConfig } from '../../dist/index.js'
3
-
4
- export default eslintConfig({ config: [ConfigOption.Ts] })
@@ -1,61 +0,0 @@
1
- // Function definitions to test various stylistic rules
2
- const myFunction1 = (): string => {
3
- const value = 10
4
-
5
- if (value > 5) {
6
- console.log('Value is greater than 5')
7
- } else {
8
- console.log('Value is 5 or less')
9
- }
10
-
11
- const result: string = value > 5 ? 'High' : 'Low'
12
- const array: number[] = [1, 2, 3]
13
-
14
- array.forEach(item => {
15
- console.log(item)
16
- })
17
-
18
- return result
19
- }
20
-
21
- // Testing object and array formatting rules
22
- const myObject: { a: number, b: number, c: number } = { a: 1, b: 2, c: 3 }
23
- const myArray: number[] = [1, 2, 3, 4, 5]
24
-
25
- // Testing padding and spacing rules
26
- if (myArray.length > 0) {
27
- console.log('Array is not empty')
28
- }
29
-
30
- const myFunction2 = (param: boolean): boolean => !!param
31
- // Testing invalid typeof comparison
32
- const count = 0
33
-
34
- if (typeof count === 'number') {
35
- console.log('Count is a number')
36
- }
37
-
38
- // Testing unused variables
39
- // eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
40
- const unusedVar = 'This is unused'
41
-
42
- // Function with multiple return statements
43
- // eslint-disable-next-line unused-imports/no-unused-vars, @typescript-eslint/no-unused-vars
44
- const complexFunction = (): string => {
45
- if (count > 10) return 'High'
46
-
47
- if (count < 0) return 'Low'
48
-
49
- return 'Medium'
50
- }
51
-
52
- // Testing no-use-before-define
53
- myDefinedFunction()
54
-
55
- // eslint-disable-next-line func-style
56
- function myDefinedFunction(): void {
57
- console.log('Function called before definition')
58
- }
59
-
60
- // Export statement to test sorting
61
- export { myFunction1, myFunction2, myObject, myArray }
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- }
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "outDir": "./dist",
5
- "rootDir": "./src"
6
- },
7
- "include": ["src/**/*.ts", "src/**/*.tsx"],
8
- "exclude": ["node_modules", "dist"]
9
- }
@@ -1,14 +0,0 @@
1
- # @santi020k/eslint-config-react
2
-
3
- React specific ESLint rules and configurations.
4
-
5
- ## Description
6
-
7
- This package provides:
8
- - `eslint-plugin-react` recommended rules.
9
- - `eslint-plugin-react-hooks` recommended rules.
10
- - JSX accessibility rules.
11
-
12
- ## Usage
13
-
14
- This package is used automatically when `ConfigOption.React` is selected in the main configuration.
@@ -1,26 +0,0 @@
1
- import jsxA11y from 'eslint-plugin-jsx-a11y'
2
- import react from 'eslint-plugin-react'
3
- import reactHooks from 'eslint-plugin-react-hooks'
4
-
5
- import core from '@santi020k/eslint-config-core'
6
-
7
- export default [
8
- ...core,
9
- {
10
- plugins: {
11
- react,
12
- 'react-hooks': reactHooks,
13
- 'jsx-a11y': jsxA11y
14
- },
15
- rules: {
16
- ...react.configs.recommended.rules,
17
- ...reactHooks.configs.recommended.rules,
18
- ...jsxA11y.configs.recommended.rules
19
- },
20
- settings: {
21
- react: {
22
- version: 'detect'
23
- }
24
- }
25
- }
26
- ]
@@ -1,49 +0,0 @@
1
- {
2
- "name": "@santi020k/eslint-config-react",
3
- "version": "0.0.0",
4
- "description": "React ESLint configuration with hooks and JSX rules",
5
- "type": "module",
6
- "main": "./dist/index.js",
7
- "module": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
9
- "exports": {
10
- ".": {
11
- "import": "./dist/index.js",
12
- "types": "./dist/index.d.ts"
13
- }
14
- },
15
- "files": [
16
- "dist"
17
- ],
18
- "scripts": {
19
- "build": "tsup",
20
- "dev": "tsup --watch",
21
- "clean": "rm -rf dist"
22
- },
23
- "peerDependencies": {
24
- "eslint": "^9.0.0",
25
- "react": ">=18.0.0"
26
- },
27
- "dependencies": {
28
- "@santi020k/eslint-config-core": "*",
29
- "@eslint/compat": "^2.0.2",
30
- "eslint-plugin-react": "^7.37.5",
31
- "eslint-plugin-react-hooks": "^7.0.1",
32
- "globals": "^17.3.0"
33
- },
34
- "devDependencies": {
35
- "@typescript-eslint/utils": "^8.54.0",
36
- "tsup": "^8.5.1",
37
- "typescript": "^5.9.3"
38
- },
39
- "publishConfig": {
40
- "access": "public"
41
- },
42
- "license": "MIT",
43
- "author": "santi020k",
44
- "repository": {
45
- "type": "git",
46
- "url": "git+https://github.com/santi020k/eslint-config.git",
47
- "directory": "packages/react"
48
- }
49
- }
@@ -1,23 +0,0 @@
1
- // Type declarations for ESLint plugins that don't ship their own types
2
-
3
- declare module 'eslint-plugin-react/configs/recommended.js' {
4
- import type { TSESLint } from '@typescript-eslint/utils'
5
-
6
- const config: TSESLint.FlatConfig.Config
7
-
8
- export default config
9
- }
10
-
11
- declare module 'eslint-plugin-react-hooks' {
12
- import type { TSESLint } from '@typescript-eslint/utils'
13
-
14
- const plugin: TSESLint.FlatConfig.Plugin & {
15
- configs: {
16
- recommended: {
17
- rules: TSESLint.Linter.RulesRecord
18
- }
19
- }
20
- }
21
-
22
- export default plugin
23
- }
@@ -1,52 +0,0 @@
1
- // @ts-check
2
- import pluginReactConfig from 'eslint-plugin-react/configs/recommended.js'
3
- import pluginReactHooks from 'eslint-plugin-react-hooks'
4
- import globals from 'globals'
5
-
6
- import { rules } from './rules.js'
7
-
8
- import { fixupConfigRules } from '@eslint/compat'
9
- import type { TSESLint } from '@typescript-eslint/utils'
10
-
11
- const languageOptions: TSESLint.FlatConfig.LanguageOptions = {
12
- ecmaVersion: 'latest',
13
- sourceType: 'module',
14
- ...(pluginReactConfig.languageOptions as TSESLint.FlatConfig.LanguageOptions),
15
- globals: {
16
- ...globals.browser,
17
- ...globals.node
18
- }
19
- }
20
-
21
- /**
22
- * React ESLint configuration
23
- * Includes React plugin recommended rules and React Hooks
24
- */
25
- export const reactConfig: TSESLint.FlatConfig.ConfigArray = [
26
- // Use type assertion to handle @eslint/compat type mismatch
27
- ...(fixupConfigRules(pluginReactConfig as unknown as Parameters<typeof fixupConfigRules>[0]).map(react => ({
28
- ...react,
29
- name: 'eslint-config-react/recommended',
30
- languageOptions,
31
- settings: {
32
- react: {
33
- version: 'detect'
34
- }
35
- }
36
- })) as unknown as TSESLint.FlatConfig.ConfigArray),
37
- {
38
- name: 'eslint-config-react/custom',
39
- plugins: {
40
- 'react-hooks': pluginReactHooks
41
- },
42
- languageOptions,
43
- files: ['**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts}'],
44
- rules: {
45
- ...pluginReactHooks.configs.recommended.rules,
46
- ...rules
47
- }
48
- }
49
- ]
50
-
51
- // Re-export rules for direct access
52
- export { rules }
@@ -1,47 +0,0 @@
1
- import { groups } from '@santi020k/eslint-config-core'
2
- import type { TSESLint } from '@typescript-eslint/utils'
3
-
4
- export const rules: TSESLint.Linter.RulesRecord = {
5
- 'react/react-in-jsx-scope': 'off',
6
- 'react/jsx-max-depth': ['warn', { max: 7 }],
7
- 'react/prop-types': 'off',
8
- 'react-hooks/exhaustive-deps': 'off',
9
- 'react/button-has-type': 'warn',
10
- 'react/display-name': 'warn',
11
- 'react/no-children-prop': 'warn',
12
- 'react/no-danger-with-children': 'warn',
13
- 'react/no-unstable-nested-components': 'warn',
14
- 'react/self-closing-comp': ['warn', { component: true, html: true }],
15
- 'react/jsx-curly-brace-presence': [
16
- 'warn',
17
- { props: 'never', children: 'never' }
18
- ],
19
- 'react/jsx-curly-newline': 'warn',
20
- 'react/destructuring-assignment': 'warn',
21
- 'react/jsx-pascal-case': 'warn',
22
- 'react/boolean-prop-naming': 'warn',
23
- 'react/hook-use-state': 'warn',
24
- 'react/jsx-boolean-value': 'warn',
25
- 'react/jsx-closing-tag-location': 'warn',
26
- 'react/jsx-closing-bracket-location': 'warn',
27
- 'react/jsx-wrap-multilines': 'warn',
28
- 'react/jsx-no-target-blank': 'warn',
29
- 'react/jsx-no-leaked-render': 'warn',
30
- 'react/jsx-handler-names': 'warn',
31
- 'react/jsx-fragments': 'warn',
32
- 'react/no-deprecated': 'warn',
33
- 'react/no-multi-comp': 'warn',
34
- 'react/no-unescaped-entities': 'warn',
35
- 'react/jsx-no-undef': 'warn',
36
- 'react/no-unknown-property': 'warn',
37
- 'simple-import-sort/imports': [
38
- 'warn',
39
- {
40
- groups: [
41
- // Packages `react` related packages come first.
42
- ['^react'],
43
- ...groups
44
- ]
45
- }
46
- ]
47
- }
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "outDir": "./dist",
5
- "rootDir": "./src"
6
- },
7
- "include": ["src/**/*.ts"],
8
- "exclude": ["node_modules", "dist"]
9
- }
@@ -1,10 +0,0 @@
1
- import { defineConfig } from 'tsup'
2
-
3
- export default defineConfig({
4
- entry: ['src/index.ts'],
5
- format: ['esm'],
6
- dts: true,
7
- clean: true,
8
- splitting: false,
9
- sourcemap: true
10
- })
@@ -1,17 +0,0 @@
1
- # @santi020k/eslint-config-tests
2
-
3
- Internal integration tests for the ESLint configuration packages.
4
-
5
- ## Description
6
-
7
- This package uses Vitest to run integration tests, verifying that:
8
- - Configs are exported correctly.
9
- - Configurations can be composed without errors.
10
- - Rules are present as expected.
11
-
12
- ## Usage
13
-
14
- Run tests:
15
- ```bash
16
- npm run test
17
- ```
@@ -1,21 +0,0 @@
1
- {
2
- "name": "@santi020k/eslint-config-tests",
3
- "private": false,
4
- "version": "0.0.0",
5
- "type": "module",
6
- "scripts": {
7
- "test": "vitest run"
8
- },
9
- "devDependencies": {
10
- "@santi020k/eslint-config-basic": "*",
11
- "@santi020k/eslint-config-core": "*",
12
- "@santi020k/eslint-config-typescript": "*",
13
- "@santi020k/eslint-config-react": "*",
14
- "@santi020k/eslint-config-astro": "*",
15
- "@santi020k/eslint-config-next": "*",
16
- "@santi020k/eslint-config-expo": "*",
17
- "vitest": "^4.0.18",
18
- "eslint": "^9.39.2",
19
- "typescript": "^5.9.3"
20
- }
21
- }