@hubspot/eslint-config-ui-extensions 0.7.3-canary.18

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 ADDED
@@ -0,0 +1,35 @@
1
+ # @hubspot/eslint-config-ui-extensions
2
+
3
+ [eslint shareable configs](https://eslint.org/docs/latest/extend/shareable-configs) for building UI Extensions on HubSpot with React and Typescript.
4
+
5
+ ## Installation
6
+
7
+ You'll first need to install [ESLint](https://eslint.org/):
8
+
9
+ ```sh
10
+ npm i eslint --save-dev
11
+ ```
12
+
13
+ Next, install `@hubspot/eslint-config-ui-extensions`:
14
+
15
+ ```sh
16
+ npm install @hubspot/eslint-config-ui-extensions --save-dev
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ This packages uses [eslint's new flat config files](https://eslint.org/docs/latest/use/configure/configuration-files-new) using `eslint.config.js` rather than the legacy `.eslintrc` config file aproach.
22
+
23
+ Create an eslint.config.js file in the root of your project:
24
+
25
+ ```js
26
+ import uiExtensions from '@hubspot/eslint-config-ui-extensions';
27
+
28
+ module.exports = [
29
+ uiExtensions,
30
+
31
+ rules: {
32
+ // other config...
33
+ }
34
+ ];
35
+ ```
package/eslintrc.js ADDED
@@ -0,0 +1,12 @@
1
+ // eslint-disable-next-line no-undef
2
+ module.exports = {
3
+ root: true,
4
+ extends: [
5
+ 'eslint:recommended',
6
+ 'plugin:eslint-plugin/recommended',
7
+ 'plugin:node/recommended',
8
+ ],
9
+ env: {
10
+ node: true,
11
+ },
12
+ };
package/lib/index.js ADDED
@@ -0,0 +1,29 @@
1
+ const eslintJS = require('@eslint/js');
2
+ const runtimeConfig = require('./runtime');
3
+ const reactConfig = require('./react');
4
+ const typescriptConfig = require('./typescript');
5
+ const prettierConfig = require('./prettier');
6
+
7
+ // eslint-disable-next-line no-undef
8
+ module.exports = {
9
+ plugins: {
10
+ ...reactConfig.plugins,
11
+ ...typescriptConfig.plugins,
12
+ },
13
+
14
+ settings: {
15
+ ...reactConfig.settings,
16
+ },
17
+
18
+ languageOptions: {
19
+ ...runtimeConfig.languageOptions,
20
+ ...typescriptConfig.languageOptions,
21
+ },
22
+
23
+ rules: {
24
+ ...reactConfig.rules,
25
+ ...typescriptConfig.rules,
26
+ ...eslintJS.configs.recommended.rules,
27
+ ...prettierConfig.rules,
28
+ },
29
+ };
@@ -0,0 +1,9 @@
1
+ const prettierConfig = require('eslint-config-prettier');
2
+
3
+ // eslint-disable-next-line no-undef
4
+ module.exports = {
5
+ // https://stackoverflow.com/a/44690309
6
+ rules: {
7
+ ...prettierConfig.rules,
8
+ },
9
+ };
package/lib/react.js ADDED
@@ -0,0 +1,21 @@
1
+ const reactPlugin = require('eslint-plugin-react');
2
+ const hooksPlugin = require('eslint-plugin-react-hooks');
3
+
4
+ // eslint-disable-next-line no-undef
5
+ module.exports = {
6
+ plugins: {
7
+ 'react-hooks': hooksPlugin,
8
+ react: reactPlugin,
9
+ },
10
+
11
+ settings: {
12
+ react: {
13
+ version: 'detect',
14
+ },
15
+ },
16
+
17
+ rules: {
18
+ ...hooksPlugin.configs.recommended.rules,
19
+ ...reactPlugin.configs.recommended.rules,
20
+ },
21
+ };
package/lib/runtime.js ADDED
@@ -0,0 +1,17 @@
1
+ const globals = require('globals');
2
+
3
+ // eslint-disable-next-line no-undef
4
+ module.exports = {
5
+ languageOptions: {
6
+ ecmaVersion: 6,
7
+ sourceType: 'module',
8
+ globals: {
9
+ ...globals.worker,
10
+ importScripts: 'off',
11
+ console: true,
12
+ React: true,
13
+ RemoteUI: true,
14
+ hubspot: true,
15
+ },
16
+ },
17
+ };
@@ -0,0 +1,22 @@
1
+ const tsParser = require('@typescript-eslint/parser');
2
+ const ts = require('@typescript-eslint/eslint-plugin');
3
+
4
+ // eslint-disable-next-line no-undef
5
+ module.exports = {
6
+ plugins: {
7
+ '@typescript-eslint': ts,
8
+ },
9
+
10
+ // https://typescript-eslint.io/packages/parser/#configuration
11
+ languageOptions: {
12
+ parser: tsParser,
13
+ parserOptions: {
14
+ ecmaFeatures: { jsx: true },
15
+ lib: ['WebWorker', 'ES6'],
16
+ // project: true,,
17
+ },
18
+ },
19
+
20
+ // https://typescript-eslint.io/rules/
21
+ rules: {},
22
+ };
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@hubspot/eslint-config-ui-extensions",
3
+ "version": "0.7.3-canary.18+ca96a332",
4
+ "description": "eslint plugins for HubSpot React-based UI Extensions",
5
+ "keywords": [
6
+ "eslint",
7
+ "eslintplugin",
8
+ "eslint-plugin"
9
+ ],
10
+ "main": "./lib/index.js",
11
+ "exports": "./lib/index.js",
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "scripts": {
16
+ "lint": "npm-run-all \"lint:*\"",
17
+ "lint:eslint-docs": "npm-run-all \"update:eslint-docs -- --check\"",
18
+ "lint:js": "eslint .",
19
+ "build": "echo 'no build command'",
20
+ "test": "echo 'mocha tests --recursive'",
21
+ "update:eslint-docs": "eslint-doc-generator"
22
+ },
23
+ "dependencies": {
24
+ "@typescript-eslint/parser": "^6.4.0",
25
+ "globals": "^13.21.0"
26
+ },
27
+ "devDependencies": {
28
+ "eslint": "^8.19.0",
29
+ "eslint-doc-generator": "^1.0.0",
30
+ "eslint-plugin-eslint-plugin": "^5.0.0",
31
+ "eslint-plugin-node": "^11.1.0",
32
+ "npm-run-all": "^4.1.5"
33
+ },
34
+ "engines": {
35
+ "node": "^16.0.0 || >= 18.0.0"
36
+ },
37
+ "peerDependencies": {
38
+ "@typescript-eslint/eslint-plugin": "^6.4.0",
39
+ "eslint": ">=8",
40
+ "eslint-config-prettier": "^9.0.0",
41
+ "eslint-plugin-react": "^7.33.1",
42
+ "eslint-plugin-react-hooks": "^4.6.0",
43
+ "typescript": "^5.0.4"
44
+ },
45
+ "peerDependenciesMeta": {
46
+ "typescript": {
47
+ "optional": true
48
+ }
49
+ },
50
+ "license": "MIT",
51
+ "gitHead": "ca96a3325f782e4127712644738edfe7f7c25466"
52
+ }