eslint-plugin-use-agnostic 0.3.2 → 0.4.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/README.md +50 -1
- package/library/agnostic20/constants/bases.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,4 +2,53 @@
|
|
|
2
2
|
|
|
3
3
|
eslint-plugin-use-agnostic highlights problematic server-client imports in projects made with the Fullstack React Architecture (Next.js App Router, etc.) based on each of their modules' derived effective directives through detailed import rule violations, thanks to the introduction of its very own 'use agnostic' directive.
|
|
4
4
|
|
|
5
|
-

|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
npm install eslint@^9.0.0 eslint-plugin-use-agnostic --save-dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Setup (using TypeScript and the Flat Config)
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
// eslint.config.js
|
|
17
|
+
|
|
18
|
+
import { defineConfig, globalIgnores } from "eslint/config";
|
|
19
|
+
import tseslint from "typescript-eslint"; // for compatibility with TypeScript, not included as a devDependency
|
|
20
|
+
|
|
21
|
+
import useAgnostic, {
|
|
22
|
+
useAgnosticPluginName,
|
|
23
|
+
agnostic20ConfigName,
|
|
24
|
+
} from "eslint-plugin-use-agnostic"; // no declaration file at this time
|
|
25
|
+
|
|
26
|
+
export default defineConfig([
|
|
27
|
+
globalIgnores([".next", ".react-router", "node_modules"]),
|
|
28
|
+
{
|
|
29
|
+
// files: ['**/*.js', '**/*.jsx'], // if you're using vanilla JavaScript
|
|
30
|
+
files: ["**/*.ts", "**/*.tsx"],
|
|
31
|
+
plugins: {
|
|
32
|
+
[useAgnosticPluginName]: useAgnostic,
|
|
33
|
+
},
|
|
34
|
+
extends: [`${useAgnosticPluginName}/${agnostic20ConfigName}`],
|
|
35
|
+
languageOptions: {
|
|
36
|
+
parser: tseslint.parser, // for compatibility with .ts and .tsx
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
]);
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
And don't forget the VS Code settings via `./.vscode/settings.json`:
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"eslint.useFlatConfig": true,
|
|
47
|
+
"eslint.validate": [
|
|
48
|
+
"javascript",
|
|
49
|
+
"javascriptreact",
|
|
50
|
+
"typescript",
|
|
51
|
+
"typescriptreact"
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
```
|
|
@@ -88,7 +88,7 @@ const makeIntroForSpecificViolationMessage = (
|
|
|
88
88
|
);
|
|
89
89
|
|
|
90
90
|
const SUGGEST_USE_AGNOSTIC =
|
|
91
|
-
"If the module you're trying to import does not possess any server-side code however, please mark it with
|
|
91
|
+
"If the module you're trying to import does not possess any server-side code however, please mark it with this plugin's own and eponymous 'use agnostic' directive to signal its compatibility across all environments.";
|
|
92
92
|
|
|
93
93
|
export const effectiveDirectives_BlockedImports = Object.freeze({
|
|
94
94
|
[USE_SERVER_LOGICS]: [
|