@widergy/eslint-config 1.0.2 → 1.0.3

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.0.3](https://github.com/widergy/eslint-config/compare/v1.0.2...v1.0.3) (2026-02-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * [DEV-766] forbid-prop-types and readme docs ([#12](https://github.com/widergy/eslint-config/issues/12)) ([1da5cfd](https://github.com/widergy/eslint-config/commit/1da5cfd574d4df59d6453b2637c200965ced5636))
7
+
1
8
  ## [1.0.2](https://github.com/widergy/eslint-config/compare/v1.0.1...v1.0.2) (2025-12-18)
2
9
 
3
10
 
package/README.md CHANGED
@@ -1 +1,103 @@
1
- # eslint-config
1
+ # @widergy/eslint-config
2
+
3
+ Widergy's shared ESLint configuration, supporting JavaScript, TypeScript, React, and React Native.
4
+
5
+ ## Prerequisites
6
+
7
+ > [!IMPORTANT]
8
+ > This configuration package **only supports ESLint v9 Flat Config**. Please ensure you have upgraded to ESLint v9 before implementing this linter.
9
+
10
+ ## Installation
11
+
12
+ 1. **Install the package**:
13
+
14
+ ```bash
15
+ npm install -D @widergy/eslint-config eslint
16
+ ```
17
+
18
+ > [!NOTE]
19
+ > Peer dependencies (like `prettier`, `typescript`, plugins, etc.) should be added on a **per-necessity basis**. The linter will fail if a required dependency for your specific configuration is missing. Read the error messages and install the missing packages as needed. This prevents installing unnecessary packages.
20
+
21
+ 2. **Verify Prettier Configuration**:
22
+ Ensure your project's `.prettierrc` file matches the rules configured in this package to avoid conflicts between the linter and the formatter.
23
+ - _Reference the Prettier rules in the "Rules Documentation" section below._
24
+
25
+ ## Post Installation (Legacy Error Handling)
26
+
27
+ To handle retrocompatibility with previous errors and avoid blocking the migration, follow these steps:
28
+
29
+ 1. **Add `lint-suppress` script**:
30
+ Add the following script to your `package.json`:
31
+
32
+ ```json
33
+ "scripts": {
34
+ "lint-suppress": "eslint src --cache --suppress-all"
35
+ }
36
+ ```
37
+
38
+ - This command suppresses all current errors, allowing you to migrate without fixing everything immediately.
39
+ - **Run this once** after successful installation to generate the `eslint-suppressions.json` file.
40
+ - **Do not run this daily**. Only use it when you change rules and want to ignore new legacy errors.
41
+
42
+ 2. **Update `lint` script**:
43
+ Modify your `lint` script to use the cache and prune unused suppressions:
44
+
45
+ ```json
46
+ "scripts": {
47
+ "lint": "eslint src --cache --prune-suppressions"
48
+ }
49
+ ```
50
+
51
+ - `--cache`: Speeds up future linting processes. **Add `.eslintcache` to your `.gitignore`**.
52
+ - `--prune-suppressions`: Automatically removes suppressions for rules that are no longer violated.
53
+
54
+ 3. **Git Hooks**:
55
+ - It is recommended to run the linting process in the **`prepush`** hook of your repository.
56
+ - If you are currently using `precommit`, consider moving it to `prepush` to avoid slowing down commits.
57
+
58
+ ## Usage
59
+
60
+ Import the specific configuration based on your project type in your `eslint.config.js` file.
61
+
62
+ ### Available Configurations
63
+
64
+ - `@widergy/eslint-config/javascript`: **JS/TS only repositories** (helpers, internal libraries, etc.).
65
+ - `@widergy/eslint-config/react`: **React Web projects**.
66
+ - `@widergy/eslint-config/react-native`: **React Native Mobile projects**.
67
+
68
+ ### Example (React Project)
69
+
70
+ ```javascript
71
+ import reactConfig from "@widergy/eslint-config/react";
72
+
73
+ export default [
74
+ ...reactConfig,
75
+ {
76
+ // Custom overrides or specific project settings can be added here
77
+ },
78
+ ];
79
+ ```
80
+
81
+ ## Rules Documentation
82
+
83
+ For detailed information on the rules enabled in this configuration, please refer to the official documentation for each plugin/rule set:
84
+
85
+ - **Base Rules (ESLint)**: [https://eslint.org/docs/latest/rules](https://eslint.org/docs/latest/rules)
86
+ - **Import Rules**: [https://github.com/import-js/eslint-plugin-import/tree/main/docs/rules](https://github.com/import-js/eslint-plugin-import/tree/main/docs/rules)
87
+ - **Prettier Rules**: [https://prettier.io/docs/options](https://prettier.io/docs/options)
88
+ - **React Rules**: [https://github.com/jsx-eslint/eslint-plugin-react/tree/master/docs/rules](https://github.com/jsx-eslint/eslint-plugin-react/tree/master/docs/rules)
89
+ - **React Hooks Rules**: [https://react.dev/reference/eslint-plugin-react-hooks](https://react.dev/reference/eslint-plugin-react-hooks)
90
+ - **React Native Rules**: [https://github.com/Intellicode/eslint-plugin-react-native/tree/master/docs/rules](https://github.com/Intellicode/eslint-plugin-react-native/tree/master/docs/rules)
91
+ - **JSX A11y Rules**: [https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/main/docs/rules](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/main/docs/rules)
92
+
93
+ ## Contributing
94
+
95
+ We welcome contributions to improve our shared configuration! To propose a change (add, remove, or modify a rule):
96
+
97
+ 1. **Open a GitHub Discussion**: Go to the "Discussions" tab in this repository.
98
+ 2. **Create a Poll**: Start a new discussion with a poll.
99
+ 3. **Required Information**:
100
+ - **Title**: The name of the rule you want to change.
101
+ - **Summary**: A brief explanation of the proposed change.
102
+ - **Documentation**: A link to the official documentation for the rule (use the links in the "Rules Documentation" section).
103
+ - **Pros/Cons**: If applicable, list the arguments for and against the change for each option in the poll.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/eslint-config",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Widergy ESLint configuration",
5
5
  "type": "module",
6
6
  "author": "widergy",
@@ -1,3 +1,5 @@
1
+ // DOCS: https://eslint.org/docs/latest/rules
2
+
1
3
  export const baseRules = {
2
4
  camelcase: "off",
3
5
  "class-methods-use-this": "off",
@@ -1,3 +1,5 @@
1
+ // DOCS: https://github.com/import-js/eslint-plugin-import/tree/main/docs/rules
2
+
1
3
  export const importRules = {
2
4
  "import/extensions": "off",
3
5
  "import/no-absolute-path": "error",
@@ -1,3 +1,5 @@
1
+ // DOCS: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/main/docs/rules
2
+
1
3
  export const jsxA11yRules = {
2
4
  "jsx-a11y/anchor-is-valid": [
3
5
  "error",
@@ -1,3 +1,5 @@
1
+ // DOCS: https://prettier.io/docs/options
2
+
1
3
  export const prettierRules = {
2
4
  "prettier/prettier": [
3
5
  "error",
@@ -1,4 +1,6 @@
1
+ // DOCS: https://react.dev/reference/eslint-plugin-react-hooks
2
+
1
3
  export const reactHooksRules = {
2
- "react-hooks/exhaustive-deps": "off", // TODO: validar
4
+ "react-hooks/exhaustive-deps": "off",
3
5
  "react-hooks/rules-of-hooks": "error",
4
6
  };
@@ -1,5 +1,6 @@
1
+ // DOCS: https://github.com/Intellicode/eslint-plugin-react-native/tree/master/docs/rules
2
+
1
3
  export const reactNativeRules = {
2
- // "react-native/no-color-literals": "off", // TODO: validar
3
4
  "react-native/no-raw-text": "off",
4
5
  "react-native/split-platform-components": "off",
5
6
  };
@@ -1,7 +1,10 @@
1
+ // DOCS: https://github.com/jsx-eslint/eslint-plugin-react/tree/master/docs/rules
2
+
1
3
  export const reactRules = {
2
4
  "react/button-has-type": "off",
3
5
  "react/destructuring-assignment": "off",
4
6
  "react/forbid-foreign-prop-types": "off",
7
+ "react/forbid-prop-types": "off",
5
8
  "react/function-component-definition": [
6
9
  "error",
7
10
  {
@@ -17,11 +20,7 @@ export const reactRules = {
17
20
  "react/jsx-one-expression-per-line": "off",
18
21
  "react/jsx-props-no-spreading": "off",
19
22
  "react/jsx-wrap-multilines": "off",
20
- // "react/jsx-fragments": ["error", "syntax"], // TODO: validar
21
- // "react/no-access-state-in-setstate": "off", // TODO: no salta
22
23
  "react/no-typos": "off",
23
- // "react/no-unstable-nested-components": "off", // TODO: validar
24
- // "react/prefer-stateless-function": "off", // TODO: no salta
25
24
  "react/prop-types": [
26
25
  "error",
27
26
  {