skyltmax_config 0.0.1
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.
- checksums.yaml +7 -0
- data/.devcontainer/.bootdone +2 -0
- data/.devcontainer/boot.sh +49 -0
- data/.devcontainer/devcontainer.json +17 -0
- data/.devcontainer/docker-compose.yml +10 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +1 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +90 -0
- data/LICENSE +21 -0
- data/README.md +139 -0
- data/eslint.config.js +1 -0
- data/eslint.js +234 -0
- data/index.js +2 -0
- data/lib/skyltmax_config.rb +0 -0
- data/package.json +57 -0
- data/pnpm-lock.yaml +3181 -0
- data/prettier.js +48 -0
- data/reset.d.ts +11 -0
- data/rubocop.rails.yml +35 -0
- data/rubocop.yml +209 -0
- data/skyltmax_config.gemspec +27 -0
- data/tsconfig.json +7 -0
- data/typescript.json +24 -0
- metadata +124 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: bcbd31d35395e4925e9a37a44624b408e64d14b0eca121cb69924f8854c218c5
|
|
4
|
+
data.tar.gz: 5a90d3b8171e5529e2de5779a0bf008c4f79fc19673d36567698dd7c50becc3b
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: ba5673af586d69e07fe54303368727339668ffa607bc622d228c3e01249b851f74bc8cd13ba3c8b0babace225efc511d389a61c57249fd62e4b8994a1537aaaf
|
|
7
|
+
data.tar.gz: 93d7b3c7f9a42d8585bd886fb6137b612bdf564e936a02a53b886534489ac7d1fb4d2a426ced92b2678f2a690eafd7574c44ba9c7a916c6e57f823f9cb81a421
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
set -e
|
|
4
|
+
|
|
5
|
+
if [ -f "/home/$HOSTLOGNAME/.ssh/id_rsa.pub.sign" ]; then
|
|
6
|
+
ln -sf /home/$HOSTLOGNAME/.ssh/id_rsa.pub.sign /home/vscode/.ssh/id_rsa.pub.sign
|
|
7
|
+
fi
|
|
8
|
+
|
|
9
|
+
sudo chown -R vscode:vscode .ruby-lsp
|
|
10
|
+
sudo chown -R vscode:vscode /usr/local/bundle
|
|
11
|
+
|
|
12
|
+
git config --global --add safe.directory $DEVC_WORKSPACE
|
|
13
|
+
|
|
14
|
+
function bootcmd() {
|
|
15
|
+
printf "\n"
|
|
16
|
+
toilet -f term -t -F border:metal "$1"
|
|
17
|
+
printf "+ $2\n"
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
MARKER_FILE=".devcontainer/.bootdone"
|
|
21
|
+
|
|
22
|
+
if [ -f "${MARKER_FILE}" ]; then
|
|
23
|
+
source "${MARKER_FILE}"
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
if [ "${BUNDLE_ALREADY_INSTALLED}" != "true" ]; then
|
|
27
|
+
bootcmd "Installing gems" "bundle install"
|
|
28
|
+
bundle install
|
|
29
|
+
BUNDLE_ALREADY_INSTALLED="true"
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
if [ "${CHANGELOG_DISPLAYED_6}" != "true" ]; then
|
|
33
|
+
if [ -f "/var/lib/smdevc/changelog" ]; then
|
|
34
|
+
printf "\n"
|
|
35
|
+
toilet -f term -t -F border:metal "Latest Changes"
|
|
36
|
+
cat /var/lib/smdevc/changelog
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
CHANGELOG_DISPLAYED_6="true"
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
echo -e "\
|
|
43
|
+
BUNDLE_ALREADY_INSTALLED=${BUNDLE_ALREADY_INSTALLED}\n\
|
|
44
|
+
CHANGELOG_DISPLAYED_6=${CHANGELOG_DISPLAYED_6}" > "${MARKER_FILE}"
|
|
45
|
+
|
|
46
|
+
printf "\n\n\e[38;2;252;163;17m"
|
|
47
|
+
toilet -f standard "Config"
|
|
48
|
+
printf "\nEnvironment prepared! Get ready to code!\n\n"
|
|
49
|
+
printf "\e[0m"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Config",
|
|
3
|
+
"dockerComposeFile": "docker-compose.yml",
|
|
4
|
+
"service": "app",
|
|
5
|
+
"workspaceFolder": "/workspaces/config",
|
|
6
|
+
"containerEnv": {
|
|
7
|
+
"RUBY_YJIT_ENABLE": "true",
|
|
8
|
+
"MALLOC_ARENA_MAX": "2",
|
|
9
|
+
"BUNDLE_JOBS": "8",
|
|
10
|
+
"DEVC_WORKSPACE": "${containerWorkspaceFolder}"
|
|
11
|
+
},
|
|
12
|
+
"mounts": [
|
|
13
|
+
"source=bundle,target=/usr/local/bundle,type=volume",
|
|
14
|
+
"source=rubylsp,target=${containerWorkspaceFolder}/.ruby-lsp,type=volume"
|
|
15
|
+
],
|
|
16
|
+
"onCreateCommand": ".devcontainer/boot.sh"
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
services:
|
|
2
|
+
app:
|
|
3
|
+
image: harbor.signmax.cloud/public/devcontainer:rails-3.4.5-14
|
|
4
|
+
volumes:
|
|
5
|
+
- ..:/workspaces/config:cached
|
|
6
|
+
shm_size: "1gb"
|
|
7
|
+
# Overrides default command so things don't shut down after the process ends.
|
|
8
|
+
command: sleep infinity
|
|
9
|
+
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
|
|
10
|
+
# (Adding the "ports" property to this file will not forward from a Codespace.)
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
inherit_from: rubocop.yml
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
skyltmax_config (0.0.1)
|
|
5
|
+
rubocop (>= 1.81.0, < 2)
|
|
6
|
+
rubocop-performance (>= 1.26.0, < 2)
|
|
7
|
+
rubocop-rails (>= 2.33.0, < 3)
|
|
8
|
+
|
|
9
|
+
GEM
|
|
10
|
+
remote: https://rubygems.org/
|
|
11
|
+
specs:
|
|
12
|
+
activesupport (8.1.1)
|
|
13
|
+
base64
|
|
14
|
+
bigdecimal
|
|
15
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
16
|
+
connection_pool (>= 2.2.5)
|
|
17
|
+
drb
|
|
18
|
+
i18n (>= 1.6, < 2)
|
|
19
|
+
json
|
|
20
|
+
logger (>= 1.4.2)
|
|
21
|
+
minitest (>= 5.1)
|
|
22
|
+
securerandom (>= 0.3)
|
|
23
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
24
|
+
uri (>= 0.13.1)
|
|
25
|
+
ast (2.4.3)
|
|
26
|
+
base64 (0.3.0)
|
|
27
|
+
bigdecimal (3.3.1)
|
|
28
|
+
concurrent-ruby (1.3.5)
|
|
29
|
+
connection_pool (2.5.4)
|
|
30
|
+
drb (2.2.3)
|
|
31
|
+
i18n (1.14.7)
|
|
32
|
+
concurrent-ruby (~> 1.0)
|
|
33
|
+
json (2.13.2)
|
|
34
|
+
language_server-protocol (3.17.0.5)
|
|
35
|
+
lint_roller (1.1.0)
|
|
36
|
+
logger (1.7.0)
|
|
37
|
+
minitest (5.26.0)
|
|
38
|
+
parallel (1.27.0)
|
|
39
|
+
parser (3.3.9.0)
|
|
40
|
+
ast (~> 2.4.1)
|
|
41
|
+
racc
|
|
42
|
+
prism (1.4.0)
|
|
43
|
+
racc (1.8.1)
|
|
44
|
+
rack (3.2.4)
|
|
45
|
+
rainbow (3.1.1)
|
|
46
|
+
regexp_parser (2.11.2)
|
|
47
|
+
rubocop (1.81.7)
|
|
48
|
+
json (~> 2.3)
|
|
49
|
+
language_server-protocol (~> 3.17.0.2)
|
|
50
|
+
lint_roller (~> 1.1.0)
|
|
51
|
+
parallel (~> 1.10)
|
|
52
|
+
parser (>= 3.3.0.2)
|
|
53
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
54
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
55
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
56
|
+
ruby-progressbar (~> 1.7)
|
|
57
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
58
|
+
rubocop-ast (1.47.1)
|
|
59
|
+
parser (>= 3.3.7.2)
|
|
60
|
+
prism (~> 1.4)
|
|
61
|
+
rubocop-performance (1.26.1)
|
|
62
|
+
lint_roller (~> 1.1)
|
|
63
|
+
rubocop (>= 1.75.0, < 2.0)
|
|
64
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
65
|
+
rubocop-rails (2.33.4)
|
|
66
|
+
activesupport (>= 4.2.0)
|
|
67
|
+
lint_roller (~> 1.1)
|
|
68
|
+
rack (>= 1.1)
|
|
69
|
+
rubocop (>= 1.75.0, < 2.0)
|
|
70
|
+
rubocop-ast (>= 1.44.0, < 2.0)
|
|
71
|
+
ruby-progressbar (1.13.0)
|
|
72
|
+
securerandom (0.4.1)
|
|
73
|
+
tzinfo (2.0.6)
|
|
74
|
+
concurrent-ruby (~> 1.0)
|
|
75
|
+
unicode-display_width (3.1.4)
|
|
76
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
|
77
|
+
unicode-emoji (4.0.4)
|
|
78
|
+
uri (1.1.1)
|
|
79
|
+
|
|
80
|
+
PLATFORMS
|
|
81
|
+
ruby
|
|
82
|
+
x86_64-linux
|
|
83
|
+
|
|
84
|
+
DEPENDENCIES
|
|
85
|
+
rubocop
|
|
86
|
+
rubocop-performance
|
|
87
|
+
skyltmax_config!
|
|
88
|
+
|
|
89
|
+
BUNDLED WITH
|
|
90
|
+
2.6.2
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Skyltmax
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# 👮 @skyltmax/config
|
|
2
|
+
|
|
3
|
+
**Reasonable ESLint, Prettier, TypeScript, and Rubocop configs**
|
|
4
|
+
|
|
5
|
+
Based on <a href="https://github.com/epicweb-dev/config">@epic-web/config</a>.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
### Rubocop
|
|
10
|
+
|
|
11
|
+
Include the gem in your `Gemfile`:
|
|
12
|
+
|
|
13
|
+
```rb
|
|
14
|
+
gem "skyltmax_config"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Inherit the configs from the gem in your `.rubocop.yml`:
|
|
18
|
+
|
|
19
|
+
```yml
|
|
20
|
+
inherit_gem:
|
|
21
|
+
skyltmax_config:
|
|
22
|
+
- rubocop.yml
|
|
23
|
+
- rubocop.rails.yml
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Prettier
|
|
27
|
+
|
|
28
|
+
The easiest way to use this config is in your `package.json`:
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
"prettier": "@skyltmax/config/prettier"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
<details>
|
|
35
|
+
<summary>Customizing Prettier</summary>
|
|
36
|
+
|
|
37
|
+
If you want to customize things, you should probably just copy/paste the built-in config. But if you really want, you
|
|
38
|
+
can override it using regular JavaScript stuff.
|
|
39
|
+
|
|
40
|
+
Create a `.prettierrc.js` file in your project root with the following content:
|
|
41
|
+
|
|
42
|
+
```js
|
|
43
|
+
import defaultConfig from "skyltmax/config/prettier"
|
|
44
|
+
|
|
45
|
+
/** @type {import("prettier").Options} */
|
|
46
|
+
export default {
|
|
47
|
+
...defaultConfig,
|
|
48
|
+
// .. your overrides here...
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
</details>
|
|
53
|
+
|
|
54
|
+
### TypeScript
|
|
55
|
+
|
|
56
|
+
Create a `tsconfig.json` file in your project root with the following content:
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"extends": ["@skyltmax/config/typescript"],
|
|
61
|
+
"include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
|
|
62
|
+
"compilerOptions": {
|
|
63
|
+
"paths": {
|
|
64
|
+
"#app/*": ["./app/*"],
|
|
65
|
+
"#tests/*": ["./tests/*"]
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Create a `reset.d.ts` file in your project with these contents:
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
import "@skyltmax/config/reset.d.ts"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
<details>
|
|
78
|
+
<summary>Customizing TypeScript</summary>
|
|
79
|
+
|
|
80
|
+
Learn more from [the TypeScript docs here](https://www.typescriptlang.org/tsconfig/#extends).
|
|
81
|
+
|
|
82
|
+
</details>
|
|
83
|
+
|
|
84
|
+
### ESLint
|
|
85
|
+
|
|
86
|
+
Create a `eslint.config.js` file in your project root with the following content:
|
|
87
|
+
|
|
88
|
+
```js
|
|
89
|
+
import { config as defaultConfig } from "@skyltmax/config/eslint"
|
|
90
|
+
|
|
91
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
92
|
+
export default [...defaultConfig]
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
<details>
|
|
96
|
+
<summary>Customizing ESLint</summary>
|
|
97
|
+
|
|
98
|
+
Learn more from
|
|
99
|
+
[the Eslint docs here](https://eslint.org/docs/latest/extend/shareable-configs#overriding-settings-from-shareable-configs).
|
|
100
|
+
|
|
101
|
+
</details>
|
|
102
|
+
|
|
103
|
+
There are endless rules we could enable. However, we want to keep our configurations minimal and only enable rules that
|
|
104
|
+
catch real problems (the kind that are likely to happen). This keeps our linting faster and reduces the number of false
|
|
105
|
+
positives.
|
|
106
|
+
|
|
107
|
+
## Publishing
|
|
108
|
+
|
|
109
|
+
This repo publishes a Ruby gem (skyltmax_config) and an npm package (@skyltmax/config) whenever a GitHub Release is published. A manual run is also available.
|
|
110
|
+
|
|
111
|
+
Setup (one-time):
|
|
112
|
+
|
|
113
|
+
- In repository Settings → Secrets and variables → Actions, add:
|
|
114
|
+
- NPM_TOKEN: npm automation token with publish permission for the @skyltmax scope
|
|
115
|
+
- RUBYGEMS_API_KEY: RubyGems API key with push access to skyltmax_config
|
|
116
|
+
- Ensure package and gem versions match. The workflow verifies that the git tag version equals both versions.
|
|
117
|
+
|
|
118
|
+
How to release:
|
|
119
|
+
|
|
120
|
+
1. Update versions:
|
|
121
|
+
- package.json: "version": x.y.z
|
|
122
|
+
- skyltmax_config.gemspec: s.version = "x.y.z"
|
|
123
|
+
2. Commit and push changes.
|
|
124
|
+
3. Create a Git tag vX.Y.Z and a GitHub Release for that tag (or run the "Publish release" workflow with that ref).
|
|
125
|
+
|
|
126
|
+
What the workflow does:
|
|
127
|
+
|
|
128
|
+
- Verifies tag version matches package.json and gemspec
|
|
129
|
+
- Publishes the npm package with provenance enabled
|
|
130
|
+
- Builds and pushes the gem to RubyGems
|
|
131
|
+
|
|
132
|
+
Notes:
|
|
133
|
+
|
|
134
|
+
- For first-time publish of a scoped npm package, access is set to public by the workflow.
|
|
135
|
+
- If your npm org enforces 2FA, the token must be an automation token.
|
|
136
|
+
|
|
137
|
+
## License
|
|
138
|
+
|
|
139
|
+
MIT
|
data/eslint.config.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./eslint.js"
|
data/eslint.js
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import globals from "globals"
|
|
2
|
+
|
|
3
|
+
const ERROR = "error"
|
|
4
|
+
const WARN = "warn"
|
|
5
|
+
const OFF = "off"
|
|
6
|
+
|
|
7
|
+
const vitestFiles = ["**/__tests__/**/*", "**/*.test.*", "**/*.spec.*"]
|
|
8
|
+
const testFiles = ["**/tests/**", "**/#tests/**", ...vitestFiles]
|
|
9
|
+
const playwrightFiles = ["**/e2e/**"]
|
|
10
|
+
|
|
11
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
12
|
+
export const config = [
|
|
13
|
+
{
|
|
14
|
+
ignores: [
|
|
15
|
+
"**/.cache/**",
|
|
16
|
+
"**/node_modules/**",
|
|
17
|
+
"**/build/**",
|
|
18
|
+
"**/public/build/**",
|
|
19
|
+
"**/playwright-report/**",
|
|
20
|
+
"**/server-build/**",
|
|
21
|
+
"**/dist/**",
|
|
22
|
+
"**/coverage/**",
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
(await import("@eslint/js")).default.configs.recommended,
|
|
27
|
+
(await import("eslint-plugin-prettier/recommended")).default,
|
|
28
|
+
|
|
29
|
+
// all files
|
|
30
|
+
{
|
|
31
|
+
plugins: {
|
|
32
|
+
import: (await import("eslint-plugin-import-x")).default,
|
|
33
|
+
},
|
|
34
|
+
languageOptions: {
|
|
35
|
+
globals: {
|
|
36
|
+
...globals.browser,
|
|
37
|
+
...globals.node,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
rules: {
|
|
41
|
+
"no-unexpected-multiline": ERROR,
|
|
42
|
+
"no-warning-comments": [ERROR, { terms: ["FIXME"], location: "anywhere" }],
|
|
43
|
+
"import/no-duplicates": [WARN, { "prefer-inline": true }],
|
|
44
|
+
"import/order": [
|
|
45
|
+
WARN,
|
|
46
|
+
{
|
|
47
|
+
alphabetize: { order: "asc", caseInsensitive: true },
|
|
48
|
+
pathGroups: [{ pattern: "#*/**", group: "internal" }],
|
|
49
|
+
groups: ["builtin", "external", "internal", "parent", "sibling", "index"],
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
// JSX/TSX files
|
|
56
|
+
{
|
|
57
|
+
files: ["**/*.tsx", "**/*.jsx"],
|
|
58
|
+
plugins: {
|
|
59
|
+
react: (await import("eslint-plugin-react")).default,
|
|
60
|
+
},
|
|
61
|
+
languageOptions: {
|
|
62
|
+
parser: (await import("typescript-eslint")).parser,
|
|
63
|
+
parserOptions: {
|
|
64
|
+
jsx: true,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
settings: {
|
|
68
|
+
react: {
|
|
69
|
+
version: "detect",
|
|
70
|
+
},
|
|
71
|
+
formComponents: ["Form"],
|
|
72
|
+
linkComponents: [
|
|
73
|
+
{
|
|
74
|
+
name: "Link",
|
|
75
|
+
linkAttribute: "to",
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: "NavLink",
|
|
79
|
+
linkAttribute: "to",
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
rules: {
|
|
84
|
+
...(await import("eslint-plugin-react")).default.configs.flat.recommended.rules,
|
|
85
|
+
...(await import("eslint-plugin-react")).default.configs.flat["jsx-runtime"].rules,
|
|
86
|
+
"react/jsx-key": WARN,
|
|
87
|
+
"react/prop-types": OFF,
|
|
88
|
+
"react/button-has-type": ERROR,
|
|
89
|
+
"react/jsx-boolean-value": WARN,
|
|
90
|
+
"react-hooks/exhaustive-deps": ERROR,
|
|
91
|
+
|
|
92
|
+
"react/jsx-no-leaked-render": [
|
|
93
|
+
WARN,
|
|
94
|
+
{
|
|
95
|
+
validStrategies: ["ternary"],
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
{
|
|
102
|
+
files: ["**/*.tsx", "**/*.jsx"],
|
|
103
|
+
...(await import("eslint-plugin-jsx-a11y")).default.flatConfigs.recommended,
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
// react-hook rules are applicable in ts/js/tsx/jsx, but only with React as a dep
|
|
107
|
+
{
|
|
108
|
+
files: ["**/*.ts?(x)", "**/*.js?(x)"],
|
|
109
|
+
plugins: {
|
|
110
|
+
"react-hooks": (await import("eslint-plugin-react-hooks")).default,
|
|
111
|
+
},
|
|
112
|
+
rules: {
|
|
113
|
+
"react-hooks/rules-of-hooks": ERROR,
|
|
114
|
+
"react-hooks/exhaustive-deps": WARN,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
// JS and JSX files
|
|
119
|
+
{
|
|
120
|
+
files: ["**/*.js?(x)"],
|
|
121
|
+
rules: {
|
|
122
|
+
"no-undef": ERROR,
|
|
123
|
+
|
|
124
|
+
// most of these rules are useful for JS but not TS because TS handles these better
|
|
125
|
+
// if it weren't for https://github.com/import-js/eslint-plugin-import/issues/2132
|
|
126
|
+
// we could enable this :(
|
|
127
|
+
// 'import/no-unresolved': ERROR,
|
|
128
|
+
"no-unused-vars": [
|
|
129
|
+
ERROR,
|
|
130
|
+
{
|
|
131
|
+
vars: "all",
|
|
132
|
+
args: "after-used",
|
|
133
|
+
argsIgnorePattern: "^_",
|
|
134
|
+
ignoreRestSiblings: true,
|
|
135
|
+
varsIgnorePattern: "^ignored",
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
// TS and TSX files
|
|
142
|
+
...(await import("typescript-eslint")).default.config({
|
|
143
|
+
files: ["**/*.ts?(x)"],
|
|
144
|
+
extends: [(await import("typescript-eslint")).default.configs.recommended],
|
|
145
|
+
languageOptions: {
|
|
146
|
+
parserOptions: {
|
|
147
|
+
projectService: true,
|
|
148
|
+
tsconfigRootDir: process.cwd(),
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
rules: {
|
|
152
|
+
"@typescript-eslint/no-unused-vars": [
|
|
153
|
+
WARN,
|
|
154
|
+
{
|
|
155
|
+
args: "after-used",
|
|
156
|
+
argsIgnorePattern: "^_",
|
|
157
|
+
ignoreRestSiblings: true,
|
|
158
|
+
varsIgnorePattern: "^ignored",
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
"import/consistent-type-specifier-style": OFF,
|
|
162
|
+
"@typescript-eslint/consistent-type-imports": [
|
|
163
|
+
WARN,
|
|
164
|
+
{
|
|
165
|
+
prefer: "type-imports",
|
|
166
|
+
disallowTypeAnnotations: true,
|
|
167
|
+
fixStyle: "inline-type-imports",
|
|
168
|
+
},
|
|
169
|
+
],
|
|
170
|
+
"@typescript-eslint/no-misused-promises": [ERROR, { checksVoidReturn: false }],
|
|
171
|
+
"@typescript-eslint/no-floating-promises": ERROR,
|
|
172
|
+
},
|
|
173
|
+
}),
|
|
174
|
+
|
|
175
|
+
// This assumes test files are those which are in the test directory or have *.test.* or *.spec.* in the filename.
|
|
176
|
+
// If a file doesn't match this assumption, then it will not be allowed to import test files.
|
|
177
|
+
{
|
|
178
|
+
files: ["**/*.ts?(x)", "**/*.js?(x)"],
|
|
179
|
+
ignores: testFiles,
|
|
180
|
+
rules: {
|
|
181
|
+
"no-restricted-imports": [
|
|
182
|
+
ERROR,
|
|
183
|
+
{
|
|
184
|
+
patterns: [
|
|
185
|
+
{
|
|
186
|
+
group: testFiles,
|
|
187
|
+
message: "Do not import test files in source files",
|
|
188
|
+
},
|
|
189
|
+
],
|
|
190
|
+
},
|
|
191
|
+
],
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
|
|
195
|
+
{
|
|
196
|
+
files: testFiles,
|
|
197
|
+
ignores: [...playwrightFiles],
|
|
198
|
+
plugins: {
|
|
199
|
+
"testing-library": (await import("eslint-plugin-testing-library")).default,
|
|
200
|
+
},
|
|
201
|
+
rules: {
|
|
202
|
+
...(await import("eslint-plugin-testing-library")).default.configs["flat/react"].rules,
|
|
203
|
+
...(await import("eslint-plugin-testing-library")).default.configs["flat/dom"].rules,
|
|
204
|
+
"testing-library/no-unnecessary-act": [ERROR, { isStrict: false }],
|
|
205
|
+
"testing-library/no-wait-for-side-effects": ERROR,
|
|
206
|
+
"testing-library/prefer-find-by": ERROR,
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
|
|
210
|
+
{
|
|
211
|
+
files: testFiles,
|
|
212
|
+
ignores: [...playwrightFiles],
|
|
213
|
+
plugins: {
|
|
214
|
+
"jest-dom": (await import("eslint-plugin-jest-dom")).default,
|
|
215
|
+
},
|
|
216
|
+
...(await import("eslint-plugin-jest-dom")).default.configs["flat/recommended"],
|
|
217
|
+
},
|
|
218
|
+
|
|
219
|
+
{
|
|
220
|
+
files: testFiles,
|
|
221
|
+
ignores: [...playwrightFiles],
|
|
222
|
+
plugins: {
|
|
223
|
+
vitest: (await import("@vitest/eslint-plugin")).default,
|
|
224
|
+
},
|
|
225
|
+
rules: {
|
|
226
|
+
...(await import("@vitest/eslint-plugin")).default.configs.recommended.rules,
|
|
227
|
+
// you don't want the editor to autofix this, but we do want to be made aware of it
|
|
228
|
+
"vitest/no-focused-tests": [WARN, { fixable: false }],
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
].filter(Boolean)
|
|
232
|
+
|
|
233
|
+
// this is for backward compatibility
|
|
234
|
+
export default config
|
data/index.js
ADDED
|
File without changes
|
data/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@skyltmax/config",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Skyltmax common configs",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://github.com/skyltmax/config#readme",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/skyltmax/config.git"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/skyltmax/config/issues"
|
|
13
|
+
},
|
|
14
|
+
"main": "index.js",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": "./index.js",
|
|
18
|
+
"./prettier": "./prettier.js",
|
|
19
|
+
"./typescript": "./typescript.json",
|
|
20
|
+
"./reset.d.ts": "./reset.d.ts",
|
|
21
|
+
"./eslint": "./eslint.js"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"format": "prettier . --write",
|
|
25
|
+
"lint": "eslint .",
|
|
26
|
+
"typecheck": "tsc",
|
|
27
|
+
"validate": "run-p -l format lint typecheck"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@total-typescript/ts-reset": "^0.6.1",
|
|
31
|
+
"@typescript-eslint/eslint-plugin": "^8.39.1",
|
|
32
|
+
"@typescript-eslint/parser": "^8.39.1",
|
|
33
|
+
"@typescript-eslint/utils": "^8.39.1",
|
|
34
|
+
"@vitest/eslint-plugin": "^1.3.4",
|
|
35
|
+
"eslint-plugin-import-x": "^4.16.1",
|
|
36
|
+
"eslint-plugin-jest-dom": "^5.5.0",
|
|
37
|
+
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
38
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
39
|
+
"eslint-plugin-react": "^7.37.5",
|
|
40
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
41
|
+
"eslint-plugin-testing-library": "^7.6.6",
|
|
42
|
+
"globals": "^16.3.0",
|
|
43
|
+
"prettier-plugin-tailwindcss": "^0.6.14",
|
|
44
|
+
"tslib": "^2.8.1",
|
|
45
|
+
"typescript-eslint": "^8.39.1"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@eslint/js": "^9.33.0",
|
|
49
|
+
"@types/react": "^18.3.0",
|
|
50
|
+
"eslint": "^9.33.0",
|
|
51
|
+
"npm-run-all": "^4.1.5",
|
|
52
|
+
"prettier": "^3.6.2",
|
|
53
|
+
"react": "^18.3.0",
|
|
54
|
+
"typescript": "^5.9.2"
|
|
55
|
+
},
|
|
56
|
+
"prettier": "./prettier.js"
|
|
57
|
+
}
|