@djangocfg/eslint-config 1.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.
- package/LICENSE +21 -0
- package/README.md +43 -0
- package/base.js +32 -0
- package/next.js +49 -0
- package/package.json +34 -0
- package/react-internal.js +39 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Reforms.ai
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# @djangocfg/eslint-config
|
|
2
|
+
|
|
3
|
+
Shared ESLint configuration for the monorepo.
|
|
4
|
+
|
|
5
|
+
## What's Inside
|
|
6
|
+
|
|
7
|
+
- **Base Config** - Core ESLint rules
|
|
8
|
+
- **Next.js Config** - Next.js specific rules
|
|
9
|
+
- **React Config** - React best practices
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Next.js App
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"extends": ["@djangocfg/eslint-config/next"]
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### React Library
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"extends": ["@djangocfg/eslint-config/react"]
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Base Config
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"extends": ["@djangocfg/eslint-config"]
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Features
|
|
38
|
+
|
|
39
|
+
- TypeScript support
|
|
40
|
+
- React hooks rules
|
|
41
|
+
- Import sorting
|
|
42
|
+
- Accessibility checks
|
|
43
|
+
- Next.js optimizations
|
package/base.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import js from "@eslint/js";
|
|
2
|
+
import eslintConfigPrettier from "eslint-config-prettier";
|
|
3
|
+
import turboPlugin from "eslint-plugin-turbo";
|
|
4
|
+
import tseslint from "typescript-eslint";
|
|
5
|
+
import onlyWarn from "eslint-plugin-only-warn";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A shared ESLint configuration for the repository.
|
|
9
|
+
*
|
|
10
|
+
* @type {import("eslint").Linter.Config[]}
|
|
11
|
+
* */
|
|
12
|
+
export const config = [
|
|
13
|
+
js.configs.recommended,
|
|
14
|
+
eslintConfigPrettier,
|
|
15
|
+
...tseslint.configs.recommended,
|
|
16
|
+
{
|
|
17
|
+
plugins: {
|
|
18
|
+
turbo: turboPlugin,
|
|
19
|
+
},
|
|
20
|
+
rules: {
|
|
21
|
+
"turbo/no-undeclared-env-vars": "warn",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
plugins: {
|
|
26
|
+
onlyWarn,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
ignores: ["dist/**"],
|
|
31
|
+
},
|
|
32
|
+
];
|
package/next.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import js from "@eslint/js";
|
|
2
|
+
import eslintConfigPrettier from "eslint-config-prettier";
|
|
3
|
+
import tseslint from "typescript-eslint";
|
|
4
|
+
import pluginReactHooks from "eslint-plugin-react-hooks";
|
|
5
|
+
import pluginReact from "eslint-plugin-react";
|
|
6
|
+
import globals from "globals";
|
|
7
|
+
import pluginNext from "@next/eslint-plugin-next";
|
|
8
|
+
import { config as baseConfig } from "./base.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A custom ESLint configuration for libraries that use Next.js.
|
|
12
|
+
*
|
|
13
|
+
* @type {import("eslint").Linter.Config[]}
|
|
14
|
+
* */
|
|
15
|
+
export const nextJsConfig = [
|
|
16
|
+
...baseConfig,
|
|
17
|
+
js.configs.recommended,
|
|
18
|
+
eslintConfigPrettier,
|
|
19
|
+
...tseslint.configs.recommended,
|
|
20
|
+
{
|
|
21
|
+
...pluginReact.configs.flat.recommended,
|
|
22
|
+
languageOptions: {
|
|
23
|
+
...pluginReact.configs.flat.recommended.languageOptions,
|
|
24
|
+
globals: {
|
|
25
|
+
...globals.serviceworker,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
plugins: {
|
|
31
|
+
"@next/next": pluginNext,
|
|
32
|
+
},
|
|
33
|
+
rules: {
|
|
34
|
+
...pluginNext.configs.recommended.rules,
|
|
35
|
+
...pluginNext.configs["core-web-vitals"].rules,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
plugins: {
|
|
40
|
+
"react-hooks": pluginReactHooks,
|
|
41
|
+
},
|
|
42
|
+
settings: { react: { version: "detect" } },
|
|
43
|
+
rules: {
|
|
44
|
+
...pluginReactHooks.configs.recommended.rules,
|
|
45
|
+
// React scope no longer necessary with new JSX transform.
|
|
46
|
+
"react/react-in-jsx-scope": "off",
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
];
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@djangocfg/eslint-config",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"author": {
|
|
5
|
+
"name": "DjangoCFG",
|
|
6
|
+
"url": "https://djangocfg.com"
|
|
7
|
+
},
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"description": "Shared ESLint configurations for Unrealon projects",
|
|
10
|
+
"type": "module",
|
|
11
|
+
"exports": {
|
|
12
|
+
"./base": "./base.js",
|
|
13
|
+
"./next-js": "./next.js",
|
|
14
|
+
"./react-internal": "./react-internal.js"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"*.js",
|
|
18
|
+
"README.md",
|
|
19
|
+
"LICENSE"
|
|
20
|
+
],
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@eslint/js": "^9.31.0",
|
|
23
|
+
"@next/eslint-plugin-next": "^15.4.2",
|
|
24
|
+
"eslint": "^9.31.0",
|
|
25
|
+
"eslint-config-prettier": "^10.1.1",
|
|
26
|
+
"eslint-plugin-only-warn": "^1.1.0",
|
|
27
|
+
"eslint-plugin-react": "^7.37.5",
|
|
28
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
29
|
+
"eslint-plugin-turbo": "^2.5.0",
|
|
30
|
+
"globals": "^16.3.0",
|
|
31
|
+
"typescript": "^5.8.2",
|
|
32
|
+
"typescript-eslint": "^8.37.0"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import js from "@eslint/js";
|
|
2
|
+
import eslintConfigPrettier from "eslint-config-prettier";
|
|
3
|
+
import tseslint from "typescript-eslint";
|
|
4
|
+
import pluginReactHooks from "eslint-plugin-react-hooks";
|
|
5
|
+
import pluginReact from "eslint-plugin-react";
|
|
6
|
+
import globals from "globals";
|
|
7
|
+
import { config as baseConfig } from "./base.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A custom ESLint configuration for libraries that use React.
|
|
11
|
+
*
|
|
12
|
+
* @type {import("eslint").Linter.Config[]} */
|
|
13
|
+
export const config = [
|
|
14
|
+
...baseConfig,
|
|
15
|
+
js.configs.recommended,
|
|
16
|
+
eslintConfigPrettier,
|
|
17
|
+
...tseslint.configs.recommended,
|
|
18
|
+
pluginReact.configs.flat.recommended,
|
|
19
|
+
{
|
|
20
|
+
languageOptions: {
|
|
21
|
+
...pluginReact.configs.flat.recommended.languageOptions,
|
|
22
|
+
globals: {
|
|
23
|
+
...globals.serviceworker,
|
|
24
|
+
...globals.browser,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
plugins: {
|
|
30
|
+
"react-hooks": pluginReactHooks,
|
|
31
|
+
},
|
|
32
|
+
settings: { react: { version: "detect" } },
|
|
33
|
+
rules: {
|
|
34
|
+
...pluginReactHooks.configs.recommended.rules,
|
|
35
|
+
// React scope no longer necessary with new JSX transform.
|
|
36
|
+
"react/react-in-jsx-scope": "off",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
];
|