@ethberry/eslint-config 5.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.
@@ -0,0 +1,72 @@
1
+
2
+ name: Manual release Publish
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ jobs:
7
+ user-publish:
8
+ if: github.event_name == 'workflow_dispatch'
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ # BEGIN INSTALL
12
+ - uses: actions/checkout@v4
13
+
14
+ - name: Install Packages npm i
15
+ run: npm i
16
+
17
+ - name: Build Packages
18
+ run: npm run build
19
+
20
+ - name: Authenticate Registry & Configure Git User
21
+ run: |
22
+ echo "@ethberry:registry=https://npm.pkg.github.com/" >> .npmrc
23
+ echo "//npm.pkg.github.com/:_authToken=$GITHUBTOKEN" >> .npmrc
24
+ git update-index --assume-unchanged .npmrc
25
+ npx npm-cli-login -u $GITHUBUSER -p $GITHUBTOKEN -e $GITHUBEMAIL -r https://npm.pkg.github.com -s @ethberry --config-path="./"
26
+ git config --global user.name '@ethberry'
27
+ git config --global user.email $GITHUBEMAIL
28
+ env:
29
+ GITHUBTOKEN: ${{ secrets.GITHUBTOKEN }}
30
+ GITHUBUSER: ${{ secrets.GITHUBUSER }}
31
+ GITHUBEMAIL: ${{ secrets.GITHUBEMAIL }}
32
+
33
+ - name: Authenticate check via npm GIT
34
+ run: npm whoami --registry=https://npm.pkg.github.com/
35
+
36
+ - name: Version by NPM
37
+ run: npm version patch -m "[Manual release] [skip ci] %s"
38
+
39
+ - uses: JS-DevTools/npm-publish@v3
40
+ with:
41
+ token: ${{ secrets.GITHUBTOKEN }}
42
+ registry: "https://npm.pkg.github.com"
43
+ ignore-scripts: true
44
+
45
+ - name: Authenticate Registry & Configure Git User
46
+ run: |
47
+ echo "@ethberry:registry=https://registry.npmjs.org/" >> .npmrc
48
+ echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
49
+ echo "//registry.npmjs.org/:username=${NPM_USER}" >> .npmrc
50
+ echo "//registry.npmjs.org/:email=${NPM_EMAIL}" >> .npmrc
51
+ git update-index --assume-unchanged .npmrc
52
+ git config --global user.name '@ethberry'
53
+ git config --global user.email $GITHUBEMAIL
54
+ env:
55
+ NPM_EMAIL: ${{ secrets.NPM_EMAIL }}
56
+ NPM_USER: ${{ secrets.NPM_USER }}
57
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
58
+
59
+ - name: Authenticate check via npm NPM
60
+ run: npm whoami --registry=https://registry.npmjs.org/
61
+
62
+ - uses: JS-DevTools/npm-publish@v3
63
+ with:
64
+ registry: "https://registry.npmjs.org"
65
+ token: ${{ secrets.NPM_TOKEN }}
66
+ ignore-scripts: true
67
+
68
+ - name: Git push
69
+ run: git push --no-verify && git push --tags --no-verify
70
+ env:
71
+ GITHUBTOKEN: ${{ secrets.GITHUBTOKEN }}
72
+
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="WEB_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$">
5
+ <excludeFolder url="file://$MODULE_DIR$/temp" />
6
+ <excludeFolder url="file://$MODULE_DIR$/.tmp" />
7
+ <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
+ </content>
9
+ <orderEntry type="inheritedJdk" />
10
+ <orderEntry type="sourceFolder" forTests="false" />
11
+ </component>
12
+ </module>
@@ -0,0 +1,6 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
5
+ </profile>
6
+ </component>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="JavaScriptLibraryMappings">
4
+ <includedPredefinedLibrary name="Node.js Core" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="MarkdownSettings">
4
+ <enabledExtensions>
5
+ <entry key="MermaidLanguageExtension" value="false" />
6
+ <entry key="PlantUMLLanguageExtension" value="false" />
7
+ </enabledExtensions>
8
+ </component>
9
+ </project>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/eslint-config.iml" filepath="$PROJECT_DIR$/.idea/eslint-config.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
package/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
package/LICENSE.md ADDED
@@ -0,0 +1,16 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 EthBerry Studio
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
6
+ documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
7
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
8
+ persons to whom the Software is furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
11
+ Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
14
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
15
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # ESLint config
2
+
3
+ This is sharable ESLint config which we use across of all our repositories. It is amazing.
4
+
5
+ ### Usage
6
+
7
+ eslint.config.mjs
8
+
9
+ ```js
10
+ import typescriptRules from "./presets/tsx.mjs";
11
+
12
+ export default [
13
+ ...typescriptRules,
14
+ ];
15
+ ```
package/index.mjs ADDED
@@ -0,0 +1 @@
1
+ export * from "./presets/tsx.mjs";
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "author": {
3
+ "email": "trejgun@gmail.com",
4
+ "name": "TrejGun",
5
+ "url": "https://trejgun.github.io/"
6
+ },
7
+ "bugs": {
8
+ "url": "https://github.com/ethberry/eslint-config/issues"
9
+ },
10
+ "dependencies": {
11
+ "@eslint/js": "9.11.0",
12
+ "@stylistic/eslint-plugin-js": "2.8.0",
13
+ "@stylistic/eslint-plugin-jsx": "2.8.0",
14
+ "@stylistic/eslint-plugin-ts": "2.8.0",
15
+ "eslint": "9.11.0",
16
+ "eslint-config-prettier": "9.1.0",
17
+ "eslint-plugin-import": "2.30.0",
18
+ "eslint-plugin-jest": "28.8.3",
19
+ "eslint-plugin-mocha": "10.5.0",
20
+ "eslint-plugin-n": "17.10.3",
21
+ "eslint-plugin-prettier": "5.2.1",
22
+ "eslint-plugin-promise": "7.1.0",
23
+ "eslint-plugin-react": "7.36.1",
24
+ "eslint-plugin-testing-library": "6.3.0",
25
+ "globals": "15.9.0",
26
+ "prettier": "3.3.3",
27
+ "typescript": "5.6.2",
28
+ "typescript-eslint": "8.6.0"
29
+ },
30
+ "engines": {
31
+ "node": ">=22"
32
+ },
33
+ "keywords": [],
34
+ "license": "MIT",
35
+ "main": "./index.mjs",
36
+ "name": "@ethberry/eslint-config",
37
+ "publishConfig": {
38
+ "registry": "https://registry.npmjs.org/"
39
+ },
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "git+https://github.com/ethberry/eslint-config.git"
43
+ },
44
+ "scripts": {
45
+ "build": "exit 0",
46
+ "lint": "eslint . --fix"
47
+ },
48
+ "sideEffects": false,
49
+ "title": "EthBerry ESLint config",
50
+ "version": "5.0.1"
51
+ }
package/presets/js.mjs ADDED
@@ -0,0 +1,11 @@
1
+ import commonRules from "../rules/common.mjs";
2
+ import promiseRules from "../rules/promise.mjs";
3
+ import nodeRules from "../rules/node.mjs";
4
+ import prettierRules from "../rules/prettier.mjs";
5
+
6
+ export default [
7
+ ...commonRules,
8
+ ...promiseRules,
9
+ ...nodeRules,
10
+ ...prettierRules,
11
+ ]
@@ -0,0 +1,13 @@
1
+ import commonRules from "../rules/common.mjs";
2
+ import promiseRules from "../rules/promise.mjs";
3
+ import nodeRules from "../rules/node.mjs";
4
+ import reactRules from "../rules/react.mjs";
5
+ import prettierRules from "../rules/prettier.mjs";
6
+
7
+ export default [
8
+ ...commonRules,
9
+ ...promiseRules,
10
+ ...nodeRules,
11
+ ...reactRules,
12
+ ...prettierRules,
13
+ ]
package/presets/ts.mjs ADDED
@@ -0,0 +1,13 @@
1
+ import typescriptRules from "../rules/typescript.mjs";
2
+ import commonRules from "../rules/common.mjs";
3
+ import promiseRules from "../rules/promise.mjs";
4
+ import nodeRules from "../rules/node.mjs";
5
+ import prettierRules from "../rules/prettier.mjs";
6
+
7
+ export default [
8
+ ...commonRules,
9
+ ...typescriptRules,
10
+ ...promiseRules,
11
+ ...nodeRules,
12
+ ...prettierRules,
13
+ ]
@@ -0,0 +1,16 @@
1
+ import typescriptRules from "../rules/typescript.mjs";
2
+ import commonRules from "../rules/common.mjs";
3
+ import promiseRules from "../rules/promise.mjs";
4
+ import nodeRules from "../rules/node.mjs";
5
+ import reactRules from "../rules/react.mjs";
6
+ import prettierRules from "../rules/prettier.mjs";
7
+
8
+ export default [
9
+ ...commonRules,
10
+ ...typescriptRules,
11
+ ...promiseRules,
12
+ ...nodeRules,
13
+ ...reactRules,
14
+ ...prettierRules,
15
+ ];
16
+
@@ -0,0 +1,70 @@
1
+ import js from "@eslint/js";
2
+ import stylisticJs from "@stylistic/eslint-plugin-js";
3
+
4
+ export default [
5
+ // base
6
+ js.configs.recommended,
7
+
8
+ // overrides
9
+ {
10
+ rules: {
11
+ "no-console": [
12
+ "error",
13
+ {
14
+ allow: ["error", "warn", "info"],
15
+ },
16
+ ],
17
+ "no-unused-vars": [
18
+ "error",
19
+ {
20
+ varsIgnorePattern: "^_",
21
+ argsIgnorePattern: "^_",
22
+ args: "after-used",
23
+ vars: "all",
24
+ },
25
+ ],
26
+ "no-void": "off",
27
+ }
28
+ },
29
+
30
+ // stylistic
31
+ {
32
+ plugins: {
33
+ "@stylistic/js": stylisticJs,
34
+ },
35
+ rules: {
36
+ "max-len": [
37
+ "error",
38
+ {
39
+ code: 120,
40
+ ignoreRegExpLiterals: true,
41
+ ignoreTemplateLiterals: true,
42
+ ignorePattern: "^\\s+d=\"", // ignore path in svg icons
43
+ },
44
+ ],
45
+ "arrow-parens": ["error", "as-needed"],
46
+ "comma-dangle": ["error", "always-multiline"],
47
+ indent: [
48
+ "error",
49
+ 2,
50
+ {
51
+ MemberExpression: 1,
52
+ SwitchCase: 1,
53
+ },
54
+ ],
55
+ "linebreak-style": ["error", "unix"],
56
+ "multiline-ternary": ["error", "always-multiline"],
57
+ "no-multiple-empty-lines": [
58
+ "error",
59
+ {
60
+ max: 2,
61
+ maxEOF: 1,
62
+ },
63
+ ],
64
+ "object-curly-spacing": ["error", "never"],
65
+ "operator-linebreak": ["error", "before"],
66
+ quotes: ["error", "double"],
67
+ semi: ["error", "always"],
68
+ },
69
+ },
70
+ ]
@@ -0,0 +1,5 @@
1
+ // eslint plugin import is not supporting eslint9 yet
2
+
3
+ export default [
4
+
5
+ ]
package/rules/node.mjs ADDED
@@ -0,0 +1,23 @@
1
+ import nodePlugin from "eslint-plugin-n";
2
+
3
+ export default [
4
+ // base
5
+ {
6
+ files: ["**/*.{js,mjs,ts,mts}"],
7
+ ...nodePlugin.configs["flat/recommended-module"],
8
+ },
9
+
10
+ // overrides
11
+ {
12
+ files: ["**/*.{js,mjs,ts,mts}"],
13
+ rules: {
14
+ "n/exports-style": ["error", "exports"],
15
+ },
16
+ },
17
+ {
18
+ rules: {
19
+ // https://github.com/eslint-community/eslint-plugin-n/issues/314
20
+ "n/no-missing-import": "off",
21
+ },
22
+ },
23
+ ];
@@ -0,0 +1,5 @@
1
+ import eslintConfigPrettier from "eslint-config-prettier";
2
+
3
+ export default [
4
+ eslintConfigPrettier
5
+ ]
@@ -0,0 +1,10 @@
1
+ import pluginPromise from "eslint-plugin-promise";
2
+
3
+ export default [
4
+ pluginPromise.configs["flat/recommended"],
5
+ {
6
+ rules: {
7
+ "promise/always-return": "off",
8
+ },
9
+ },
10
+ ];
@@ -0,0 +1,47 @@
1
+ import reactPlugin from "eslint-plugin-react";
2
+ import globals from "globals";
3
+ import stylisticJsx from "@stylistic/eslint-plugin-jsx";
4
+
5
+ export default [
6
+ // config
7
+ {
8
+ files: ["**/*.{jsx,mjsx,tsx,mtsx}"],
9
+ languageOptions: {
10
+ globals: {
11
+ ...globals.browser,
12
+ ...globals.serviceworker,
13
+ },
14
+ },
15
+ settings: {
16
+ react: {
17
+ version: "detect",
18
+ },
19
+ },
20
+ },
21
+
22
+ // base
23
+ {
24
+ files: ["**/*.{jsx,mjsx,tsx,mtsx}"],
25
+ ...reactPlugin.configs.flat.recommended,
26
+ },
27
+
28
+ // overrides
29
+ {
30
+ files: ["**/*.{jsx,mjsx,tsx,mtsx}"],
31
+ rules: {
32
+ "react/react-in-jsx-scope": "off",
33
+ "react/display-name": "off",
34
+ "react/prop-types": "off",
35
+ },
36
+ },
37
+
38
+ // stylistic
39
+ {
40
+ plugins: {
41
+ "@stylistic/jsx": stylisticJsx,
42
+ },
43
+ rules: {
44
+ "@stylistic/jsx/jsx-indent": ["error", 2],
45
+ },
46
+ },
47
+ ]
@@ -0,0 +1,60 @@
1
+ import tsEslint from "typescript-eslint";
2
+ import stylisticTs from "@stylistic/eslint-plugin-ts";
3
+
4
+ export default [
5
+ // base
6
+ ...tsEslint.configs.recommendedTypeChecked,
7
+ ...tsEslint.configs.stylisticTypeChecked,
8
+
9
+ {
10
+ files: ["**/*.{js,mjs,cjs,jsx}"],
11
+ ...tsEslint.configs.disableTypeChecked,
12
+ },
13
+
14
+ // overrides
15
+ {
16
+ files: ["**/*.{ts,tsx,mtsx}"],
17
+ rules: {
18
+ "@typescript-eslint/no-unsafe-return": "warn",
19
+ "@typescript-eslint/no-unsafe-call": "warn",
20
+ "@typescript-eslint/no-misused-promises": "warn",
21
+ "@typescript-eslint/ban-ts-comment": "off",
22
+ "@typescript-eslint/array-type": "off",
23
+ "@typescript-eslint/prefer-nullish-coalescing": "off",
24
+ "@typescript-eslint/unbound-method": "off",
25
+ "@typescript-eslint/no-empty-object-type": "off",
26
+ "@typescript-eslint/no-explicit-any": "off",
27
+ "@typescript-eslint/no-unsafe-argument": "off",
28
+ "@typescript-eslint/no-unsafe-assignment": "off",
29
+ "@typescript-eslint/no-unsafe-member-access": "off",
30
+ "@typescript-eslint/no-unused-vars": [
31
+ "error",
32
+ {
33
+ varsIgnorePattern: "^_|NodeJS|ProcessEnv",
34
+ argsIgnorePattern: "^_",
35
+ args: "after-used",
36
+ vars: "all",
37
+ },
38
+ ],
39
+ "@typescript-eslint/naming-convention": [
40
+ "error",
41
+ {
42
+ selector: "interface",
43
+ format: ["PascalCase"],
44
+ prefix: ["I"],
45
+ filter: {
46
+ match: false,
47
+ regex: "^(ProcessEnv|Window)$",
48
+ },
49
+ },
50
+ ],
51
+ },
52
+ },
53
+
54
+ // stylistic
55
+ {
56
+ plugins: {
57
+ "@stylistic/ts": stylisticTs,
58
+ },
59
+ },
60
+ ]
package/tests/jest.mjs ADDED
@@ -0,0 +1,19 @@
1
+ import globals from "globals";
2
+ import jestPlugin from "eslint-plugin-jest";
3
+
4
+ export default [
5
+ {
6
+ files: ["**/*.spec.ts", "**/*.spec.js"],
7
+ ...jestPlugin.configs["flat/recommended"],
8
+ rules: {
9
+ ...jestPlugin.configs["flat/recommended"].rules,
10
+ "jest/no-focused-tests": "error",
11
+ "jest/valid-expect": "error",
12
+ },
13
+ languageOptions: {
14
+ globals: {
15
+ ...globals.jest,
16
+ },
17
+ },
18
+ },
19
+ ];
@@ -0,0 +1,22 @@
1
+ import globals from "globals";
2
+ import mochaPlugin from "eslint-plugin-mocha";
3
+
4
+ export default [
5
+ {
6
+ files: ["**/*.spec.ts", "**/*.spec.js"],
7
+ ...mochaPlugin.configs.flat.recommended,
8
+ rules: {
9
+ ...mochaPlugin.configs.flat.recommended.rules,
10
+ "mocha/no-exports": "off",
11
+ "mocha/no-hooks-for-single-case": "off",
12
+ "mocha/no-skipped-tests": "off",
13
+ "mocha/no-setup-in-describe": "off",
14
+ "mocha/no-exclusive-tests": "error",
15
+ },
16
+ languageOptions: {
17
+ globals: {
18
+ ...globals.mocha,
19
+ },
20
+ },
21
+ },
22
+ ];
@@ -0,0 +1,17 @@
1
+ import testingLibraryPlugin from "eslint-plugin-testing-library";
2
+
3
+ export default [
4
+ {
5
+ files: ["**/*.spec.tsx", "**/*.spec.jsx"],
6
+ ...testingLibraryPlugin.configs["flat/dom"],
7
+ ...testingLibraryPlugin.configs['flat/react'],
8
+ rules: {
9
+ ...testingLibraryPlugin.configs["flat/dom"].rules,
10
+ ...testingLibraryPlugin.configs['flat/react'].rules,
11
+ "testing-library/await-async-queries": "error",
12
+ "testing-library/no-await-sync-queries": "error",
13
+ "testing-library/no-debugging-utils": "warn",
14
+ "testing-library/no-dom-import": "off",
15
+ },
16
+ },
17
+ ];