@fixedwidthtable/fixedwidthtable 0.0.1-security → 0.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.

Potentially problematic release.


This version of @fixedwidthtable/fixedwidthtable might be problematic. Click here for more details.

Files changed (69) hide show
  1. package/.eslintignore +2 -0
  2. package/.eslintrc.js +8 -0
  3. package/.github/dependabot.yml +24 -0
  4. package/.github/workflows/audit.yml +14 -0
  5. package/.github/workflows/ci.yml +53 -0
  6. package/.github/workflows/release.yml +31 -0
  7. package/.github/workflows/reusable-audit.yml +41 -0
  8. package/.github/workflows/reusable-lint.yml +33 -0
  9. package/CODEOWNERS +1 -0
  10. package/LICENSE.md +18 -0
  11. package/README.md +12 -3
  12. package/e2e/browser/test/e2e.playwright.ts +67 -0
  13. package/e2e/browser/test/globalSetup.ts +30 -0
  14. package/e2e/browser/test-app/.eslintrc.js +6 -0
  15. package/e2e/browser/test-app/README.md +46 -0
  16. package/e2e/browser/test-app/components/appContainer/index.tsx +109 -0
  17. package/e2e/browser/test-app/components/solidClient/index.tsx +149 -0
  18. package/e2e/browser/test-app/next-env.d.ts +5 -0
  19. package/e2e/browser/test-app/next.config.js +6 -0
  20. package/e2e/browser/test-app/package-lock.json +1982 -0
  21. package/e2e/browser/test-app/package.json +25 -0
  22. package/e2e/browser/test-app/pages/_app.tsx +28 -0
  23. package/e2e/browser/test-app/pages/index.tsx +36 -0
  24. package/e2e/browser/test-app/tsconfig.json +20 -0
  25. package/eslint-configs/README.md +75 -0
  26. package/eslint-configs/eslint-config-base/README.md +29 -0
  27. package/eslint-configs/eslint-config-base/index.js +159 -0
  28. package/eslint-configs/eslint-config-base/license-header.js +20 -0
  29. package/eslint-configs/eslint-config-base/package.json +41 -0
  30. package/eslint-configs/eslint-config-lib/README.md +51 -0
  31. package/eslint-configs/eslint-config-lib/index.js +83 -0
  32. package/eslint-configs/eslint-config-lib/package.json +29 -0
  33. package/eslint-configs/eslint-config-react/README.md +97 -0
  34. package/eslint-configs/eslint-config-react/index.js +75 -0
  35. package/eslint-configs/eslint-config-react/package.json +32 -0
  36. package/lerna.json +4 -0
  37. package/package.json +45 -3
  38. package/packages/base-rollup-config/README.md +22 -0
  39. package/packages/base-rollup-config/index.mjs +59 -0
  40. package/packages/base-rollup-config/package.json +25 -0
  41. package/packages/internal-playwright-helpers/README.md +30 -0
  42. package/packages/internal-playwright-helpers/package.json +29 -0
  43. package/packages/internal-playwright-helpers/rollup.config.mjs +57 -0
  44. package/packages/internal-playwright-helpers/src/fixtures.ts +51 -0
  45. package/packages/internal-playwright-helpers/src/flows/auth.ts +93 -0
  46. package/packages/internal-playwright-helpers/src/index.ts +26 -0
  47. package/packages/internal-playwright-helpers/src/pages/cognito.ts +48 -0
  48. package/packages/internal-playwright-helpers/src/pages/open-id.ts +56 -0
  49. package/packages/internal-playwright-helpers/src/pages/testPage.ts +74 -0
  50. package/packages/internal-playwright-helpers/tsconfig.json +8 -0
  51. package/packages/internal-playwright-testids/package.json +22 -0
  52. package/packages/internal-playwright-testids/rollup.config.mjs +56 -0
  53. package/packages/internal-playwright-testids/src/index.ts +35 -0
  54. package/packages/internal-playwright-testids/tsconfig.json +8 -0
  55. package/packages/internal-test-env/README.md +44 -0
  56. package/packages/internal-test-env/env/.env.example +36 -0
  57. package/packages/internal-test-env/index.ts +474 -0
  58. package/packages/internal-test-env/package.json +30 -0
  59. package/packages/internal-test-env/rollup.config.mjs +80 -0
  60. package/packages/internal-test-env/tsconfig.json +20 -0
  61. package/packages/internal-test-env/utils.ts +31 -0
  62. package/packages/jest-jsdom-polyfills/README.md +21 -0
  63. package/packages/jest-jsdom-polyfills/index.js +80 -0
  64. package/packages/jest-jsdom-polyfills/package.json +36 -0
  65. package/playwright.config.ts +76 -0
  66. package/scripts/index.js +1 -0
  67. package/scripts/prepare-release.sh +32 -0
  68. package/scripts/release.sh +36 -0
  69. package/tsconfig.base.json +17 -0
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "test",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "dev": "next dev",
7
+ "build": "next build",
8
+ "start": "next start",
9
+ "lint": "next lint"
10
+ },
11
+ "dependencies": {
12
+ "@inrupt/solid-client": "^1.30.0",
13
+ "@inrupt/solid-client-authn-browser": "^1.17.1",
14
+ "next": "^13.4.19",
15
+ "react": "^18.2.0",
16
+ "react-dom": "^18.2.0"
17
+ },
18
+ "devDependencies": {
19
+ "@types/node": "^20.6.0",
20
+ "@types/react": "^18.2.21",
21
+ "@types/react-dom": "^18.2.7",
22
+ "eslint": "^8.49.0",
23
+ "typescript": "^5.2.2"
24
+ }
25
+ }
@@ -0,0 +1,28 @@
1
+ //
2
+ // Copyright Inrupt Inc.
3
+ //
4
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ // of this software and associated documentation files (the "Software"), to deal in
6
+ // the Software without restriction, including without limitation the rights to use,
7
+ // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
8
+ // Software, and to permit persons to whom the Software is furnished to do so,
9
+ // subject to the following conditions:
10
+ //
11
+ // The above copyright notice and this permission notice shall be included in
12
+ // all copies or substantial portions of the Software.
13
+ //
14
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15
+ // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
16
+ // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
17
+ // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
18
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
19
+ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ //
21
+
22
+ import type { AppProps } from "next/app";
23
+
24
+ function MyApp({ Component, pageProps }: AppProps) {
25
+ return <Component {...pageProps} />;
26
+ }
27
+
28
+ export default MyApp;
@@ -0,0 +1,36 @@
1
+ //
2
+ // Copyright Inrupt Inc.
3
+ //
4
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ // of this software and associated documentation files (the "Software"), to deal in
6
+ // the Software without restriction, including without limitation the rights to use,
7
+ // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
8
+ // Software, and to permit persons to whom the Software is furnished to do so,
9
+ // subject to the following conditions:
10
+ //
11
+ // The above copyright notice and this permission notice shall be included in
12
+ // all copies or substantial portions of the Software.
13
+ //
14
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15
+ // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
16
+ // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
17
+ // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
18
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
19
+ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ //
21
+
22
+ import type { NextPage } from "next";
23
+ // Disabling the following prevents from having to install before linting from
24
+ // the root.
25
+ // eslint-disable-next-line import/no-unresolved
26
+ import dynamic from "next/dynamic";
27
+
28
+ const App = dynamic(() => import("../components/appContainer"), {
29
+ ssr: false,
30
+ });
31
+
32
+ const Home: NextPage = () => {
33
+ return <App />;
34
+ };
35
+
36
+ export default Home;
@@ -0,0 +1,20 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es5",
4
+ "lib": ["dom", "dom.iterable", "esnext"],
5
+ "allowJs": true,
6
+ "skipLibCheck": true,
7
+ "strict": true,
8
+ "forceConsistentCasingInFileNames": true,
9
+ "noEmit": true,
10
+ "esModuleInterop": true,
11
+ "module": "esnext",
12
+ "moduleResolution": "node",
13
+ "resolveJsonModule": true,
14
+ "isolatedModules": true,
15
+ "jsx": "preserve",
16
+ "incremental": true
17
+ },
18
+ "include": ["next-env.d.ts", "next.config.js", "**/*.ts", "**/*.tsx"],
19
+ "exclude": ["node_modules", ".next"]
20
+ }
@@ -0,0 +1,75 @@
1
+ # eslint-configs
2
+
3
+ ESLint config used as the base for all Inrupt projects. You'll likely want to
4
+ import [eslint-config-inrupt-lib](./eslint-config-inrupt-lib) or
5
+ [eslint-config-inrupt-react](./eslint-config-inrupt-react).
6
+
7
+ ## Usage
8
+
9
+ In order to use these ESLint configurations, you will need to add the following
10
+ line to the top of your project's `.eslintrc.js` file:
11
+
12
+ ```
13
+ require("@rushstack/eslint-patch/modern-module-resolution");
14
+ ```
15
+
16
+ This ensures that you load the dependencies from the ESLint configuration,
17
+ instead of your project. This patch is a workaround for the long-standing ESLint
18
+ [issue 3458](https://github.com/eslint/eslint/issues/3458) regarding how ESLint
19
+ loads modules.
20
+
21
+ ## Configurations
22
+
23
+ ### `@inrupt/eslint-config-lib`
24
+
25
+ Use this configuration to load all the TypeScript-specific rules - it builds on
26
+ top of `@inrupt/eslint-config-base`.
27
+
28
+ ### `@inrupt/eslint-config-react`
29
+
30
+ Use this configuration for React projects or packages, it too builds on top of
31
+ `@inrupt/eslint-config-base`.
32
+
33
+ If you're working on a TypeScript project or package, you'll need additional
34
+ configuration to get TypeScript working:
35
+
36
+ ```js
37
+ parserOptions: {
38
+ project: "./tsconfig.eslint.json",
39
+ },
40
+
41
+ // These settings and the `plugin:import/typescript` are required until we add
42
+ // this configuration to our @inrupt/eslint-config-lib base
43
+ settings: {
44
+ "import/parsers": {
45
+ "@typescript-eslint/parser": [".ts", ".tsx"],
46
+ },
47
+ "import/resolver": {
48
+ typescript: {
49
+ alwaysTryTypes: true,
50
+ project: "./tsconfig.eslint.json",
51
+ },
52
+ },
53
+ },
54
+
55
+ rules: {
56
+ "react/jsx-filename-extension": [
57
+ "error",
58
+ {
59
+ extensions: [".tsx"],
60
+ },
61
+ ],
62
+ },
63
+ ```
64
+
65
+ ## Rules
66
+
67
+ Our general principles are as follows:
68
+
69
+ - Use [airbnb-base](https://www.npmjs.com/package/eslint-config-airbnb-base).
70
+ - Load recommended configs for common libraries: e.g., eslint, jest, typescript.
71
+ - Load Prettier config to override everything where there are conflicts.
72
+ - Enforce licensing headers.
73
+ - Configure common problems (no-shadow, no-unresolved, etc).
74
+ - Load React-specific configs for React projects.
75
+ - Do very little else - i.e., as few custom rules or overrides as possible.
@@ -0,0 +1,29 @@
1
+ # eslint-config-inrupt-base
2
+
3
+ Eslint config which is the base for all inrupt projects. You likely want to import
4
+ [eslint-config-inrupt-lib](../eslint-config-inrupt-lib) or
5
+ [eslint-config-inrupt-react](../eslint-config-inrupt-react) instead.
6
+
7
+ ## Usage
8
+
9
+ In order to use this style configuration, you'll need to add the following
10
+ line to the top of the `.eslintrc.js` file:
11
+
12
+ ```
13
+ require("@rushstack/eslint-patch/modern-module-resolution");
14
+ ```
15
+
16
+ This ensures that you load the dependencies from the style configuration,
17
+ instead of your project. This patch is a workaround for the longstanding eslint
18
+ [issue 3458](https://github.com/eslint/eslint/issues/3458) regarding how eslint
19
+ loads modules.
20
+
21
+ ## Rules
22
+
23
+ Exhaustive documentation forthcoming. For now, the general principles are:
24
+
25
+ - Load a stylistic base set - in this case,
26
+ [airbnb-base](https://www.npmjs.com/package/eslint-config-airbnb-base)
27
+ - Load recommended configs for common libraries: eslint, jest, typescript
28
+ - Load prettier config to override everything where there are conflicts
29
+ - Do very little else- as few custom rules or overrides as possible
@@ -0,0 +1,159 @@
1
+ //
2
+ // Copyright Inrupt Inc.
3
+ //
4
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ // of this software and associated documentation files (the "Software"), to deal in
6
+ // the Software without restriction, including without limitation the rights to use,
7
+ // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
8
+ // Software, and to permit persons to whom the Software is furnished to do so,
9
+ // subject to the following conditions:
10
+ //
11
+ // The above copyright notice and this permission notice shall be included in
12
+ // all copies or substantial portions of the Software.
13
+ //
14
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15
+ // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
16
+ // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
17
+ // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
18
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
19
+ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ //
21
+
22
+ module.exports = {
23
+ env: {
24
+ browser: true,
25
+ node: true,
26
+ es2022: true,
27
+ },
28
+
29
+ // Airbnb base provides many style rules; it is then overridden by our current defaults
30
+ // (eslint and prettier recommended configs)
31
+ extends: ["airbnb-base", "eslint:recommended", "plugin:prettier/recommended"],
32
+ plugins: ["prettier", "header"],
33
+
34
+ // A few fixes for broken .eslint rules
35
+ globals: {
36
+ Atomics: "readonly",
37
+ SharedArrayBuffer: "readonly",
38
+ },
39
+
40
+ settings: {
41
+ "import/resolver": {
42
+ node: {
43
+ extensions: [".js", ".ts"],
44
+ },
45
+ },
46
+ jest: {
47
+ // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires, import/extensions
48
+ version: require("jest/package.json").version,
49
+ },
50
+ },
51
+
52
+ rules: {
53
+ // Don't allow overwriting built-in globals like URL
54
+ "no-shadow": ["error", { builtinGlobals: true }],
55
+
56
+ // Make everything work with .ts and .tsx as well
57
+ "import/extensions": [
58
+ "error",
59
+ {
60
+ js: "never",
61
+ ts: "never",
62
+ tsx: "never",
63
+ },
64
+ ],
65
+
66
+ // Allow devDeps in test files
67
+ "import/no-extraneous-dependencies": [
68
+ "off",
69
+ {
70
+ devDependencies: ["**/*.test.*"],
71
+ },
72
+ ],
73
+
74
+ // import/no-unresolved is problematic because of the RDF/JS specification, which has type
75
+ // definitions available in @types/rdf-js, but no actual corresponding rdf-js package.
76
+ "import/no-unresolved": [
77
+ "error",
78
+ {
79
+ ignore: ["rdf-js"],
80
+ },
81
+ ],
82
+
83
+ // Remove airbnb's ForOfStatement recommendation; we don't use regenerator-runtime anyway,
84
+ // and we iterate over Sets in our libraries.
85
+ "no-restricted-syntax": [
86
+ "error",
87
+ {
88
+ selector: "ForInStatement",
89
+ message:
90
+ "for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.",
91
+ },
92
+ {
93
+ selector: "LabeledStatement",
94
+ message:
95
+ "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.",
96
+ },
97
+ {
98
+ selector: "WithStatement",
99
+ message:
100
+ "`with` is disallowed in strict mode because it makes code impossible to predict and optimize.",
101
+ },
102
+ ],
103
+
104
+ // Leaving out the await can hide the fact that you're not catching thrown errors:
105
+ // https://twitter.com/_jayphelps/status/1324565522755788803
106
+ // Additionally, it will prevent the function from being part of the stack trace
107
+ // if not catching them:
108
+ // https://eslint.org/docs/rules/no-return-await
109
+ // Thus, we use the rule that can use type annotation to ensure we await Promises used in
110
+ // try..catch blocks:
111
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/return-await.md
112
+ "no-return-await": ["off"],
113
+
114
+ // Ensure all code has a license header:
115
+ "header/header": ["warn", require.resolve("./license-header.js")],
116
+
117
+ // set eol to auto to handle all environments
118
+ "prettier/prettier": ["error", { endOfLine: "auto" }],
119
+ },
120
+
121
+ overrides: [
122
+ {
123
+ files: [
124
+ "**/*.test.ts",
125
+ "**/*.test.tsx",
126
+ "**/*.test.js",
127
+ "**/*.test.jsx",
128
+ // legacy: we need to standardise around *.test.ts
129
+ "**/*.spec.ts",
130
+ "**/*.spec.tsx",
131
+ "**/*.spec.js",
132
+ "**/*.spec.jsx",
133
+ ],
134
+ plugins: ["jest"],
135
+ extends: ["plugin:jest/recommended", "plugin:jest/style"],
136
+ rules: {
137
+ "no-shadow": [
138
+ "warn",
139
+ {
140
+ allow: [
141
+ "describe",
142
+ "it",
143
+ "jest",
144
+ "expect",
145
+ "beforeEach",
146
+ "beforeAll",
147
+ "afterEach",
148
+ "afterAll",
149
+ ],
150
+ },
151
+ ],
152
+ },
153
+ },
154
+ {
155
+ files: ["e2e/browser/**/*.playwright.ts"],
156
+ extends: ["plugin:playwright/playwright-test"],
157
+ },
158
+ ],
159
+ };
@@ -0,0 +1,20 @@
1
+ //
2
+ // Copyright Inrupt Inc.
3
+ //
4
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ // of this software and associated documentation files (the "Software"), to deal in
6
+ // the Software without restriction, including without limitation the rights to use,
7
+ // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
8
+ // Software, and to permit persons to whom the Software is furnished to do so,
9
+ // subject to the following conditions:
10
+ //
11
+ // The above copyright notice and this permission notice shall be included in
12
+ // all copies or substantial portions of the Software.
13
+ //
14
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15
+ // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
16
+ // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
17
+ // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
18
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
19
+ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ //
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@inrupt/eslint-config-base",
3
+ "description": "Shared eslint config for Javascript at @inrupt",
4
+ "version": "2.4.0",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "main": "index.js",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/inrupt/typescript-sdk-tools.git"
12
+ },
13
+ "keywords": [
14
+ "eslint",
15
+ "inrupt"
16
+ ],
17
+ "author": "Inrupt <engineering@inrupt.com>",
18
+ "license": "MIT",
19
+ "bugs": {
20
+ "url": "https://github.com/inrupt/typescript-sdk-tools/issues"
21
+ },
22
+ "homepage": "https://github.com/inrupt/typescript-sdk-tools/tree/main/eslint-configs/eslint-config-base#readme",
23
+ "dependencies": {
24
+ "eslint": ">=8.49.0",
25
+ "eslint-config-airbnb-base": "^15.0.0",
26
+ "eslint-config-prettier": "^9.0.0",
27
+ "eslint-plugin-header": "^3.1.1",
28
+ "eslint-plugin-import": "^2.28.1",
29
+ "eslint-plugin-jest": "^27.2.3",
30
+ "eslint-plugin-playwright": "^0.16.0",
31
+ "eslint-plugin-prettier": "^5.0.0",
32
+ "jest": ">=29.6.4",
33
+ "prettier": ">=3.0.3"
34
+ },
35
+ "peerDependencies": {
36
+ "@rushstack/eslint-patch": ">=1.1.4",
37
+ "eslint": ">=8.49.0",
38
+ "jest": ">=29.6.4",
39
+ "prettier": ">=3.0.3"
40
+ }
41
+ }
@@ -0,0 +1,51 @@
1
+ # eslint-config-inrupt-lib
2
+
3
+ Eslint and prettier configs
4
+
5
+ ## Installation
6
+
7
+ 1. `npm install --save-dev @inrupt/eslint-config-lib @rushstack/eslint-patch`
8
+
9
+ ## Setup (Quick start)
10
+
11
+ Create a `.eslintrc.js` in the the root of your project with the following contents:
12
+
13
+ ```js
14
+ require("@rushstack/eslint-patch/modern-module-resolution");
15
+
16
+ module.exports = {
17
+ extends: ["@inrupt/eslint-config-lib"],
18
+ parserOptions: {
19
+ project: "./tsconfig.eslint.json",
20
+ },
21
+ rules: {},
22
+ };
23
+ ```
24
+
25
+ The file `tsconfig.eslint.json` is your typescript configuration with the e2e tests, unit tests and examples included, e.g.,
26
+
27
+ ```json
28
+ {
29
+ "extends": "./tsconfig.json",
30
+ "include": ["src/**/*.ts", "e2e/**/*.ts", "examples/**/*.ts", "*.md"],
31
+ "exclude": ["**/node_modules", "**/dist/**"]
32
+ }
33
+ ```
34
+
35
+ ## Migrating to this configuration:
36
+
37
+ 1. Add `extends: ['@inrupt/eslint-config-lib']` to your `.eslintrc.js` file.
38
+ 1. Add the following line to the top of the `.eslintrc.js` file:
39
+
40
+ ```js
41
+ require("@rushstack/eslint-patch/modern-module-resolution");
42
+ ```
43
+
44
+ ## Rules
45
+
46
+ Exhaustive documentation forthcoming. For now, the general principles are:
47
+
48
+ - Load inrupt-base, which loads recommended configs for common libraries: eslint, jest, typescript,
49
+ and prettier
50
+ - Do very little else- as few custom rules or overrides as possible.
51
+ - Some rules are updated to work with nextjs.
@@ -0,0 +1,83 @@
1
+ //
2
+ // Copyright Inrupt Inc.
3
+ //
4
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ // of this software and associated documentation files (the "Software"), to deal in
6
+ // the Software without restriction, including without limitation the rights to use,
7
+ // copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
8
+ // Software, and to permit persons to whom the Software is furnished to do so,
9
+ // subject to the following conditions:
10
+ //
11
+ // The above copyright notice and this permission notice shall be included in
12
+ // all copies or substantial portions of the Software.
13
+ //
14
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15
+ // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
16
+ // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
17
+ // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
18
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
19
+ // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ //
21
+
22
+ module.exports = {
23
+ extends: [
24
+ "@inrupt/eslint-config-base",
25
+ "plugin:@typescript-eslint/recommended",
26
+ ],
27
+
28
+ plugins: ["@typescript-eslint"],
29
+
30
+ overrides: [
31
+ {
32
+ files: ["*.ts", "*.tsx"],
33
+
34
+ parser: "@typescript-eslint/parser",
35
+
36
+ // Load typescript rules to handle es6 and typescript
37
+ parserOptions: {
38
+ project: "./**/tsconfig*.json",
39
+ ecmaVersion: 2018,
40
+ sourceType: "module",
41
+ },
42
+
43
+ rules: {
44
+ "@typescript-eslint/return-await": ["error", "in-try-catch"],
45
+
46
+ // Allow empty arrow functions, useful as defaults or for testing mocks
47
+ "@typescript-eslint/no-empty-function": [
48
+ "error",
49
+ { allow: ["arrowFunctions"] },
50
+ ],
51
+
52
+ "@typescript-eslint/no-floating-promises": "error",
53
+
54
+ // We allow underscores in some situations, such as internal_ or unstable_. Additionally,
55
+ // many of the libraries we use commonly use underscores, so disable this rule.
56
+ "@typescript-eslint/camelcase": ["off"],
57
+
58
+ // Use typescript's definition checker
59
+ "no-use-before-define": ["off"],
60
+ "@typescript-eslint/no-use-before-define": ["warn"],
61
+
62
+ // Ensure that type only imports are used whenever possible; this is also important
63
+ // to avoid violating the import/no-unresolved rule when type-only packages such as
64
+ // @rdfjs/types are used
65
+ //
66
+ // For instance if we have:
67
+ // ```ts
68
+ // import { Term } from '@rdfjs/types';
69
+ // ```
70
+ // Then the import/no-unresolved rule is violated; but eslint --fix is unable to resolve
71
+ // the problem. By adding this rule eslint --fix is able to set this to:
72
+ // ```ts
73
+ // import type { Term } from '@rdfjs/types';
74
+ // ```
75
+ //
76
+ "@typescript-eslint/consistent-type-imports": [
77
+ "error",
78
+ { prefer: "type-imports" },
79
+ ],
80
+ },
81
+ },
82
+ ],
83
+ };
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@inrupt/eslint-config-lib",
3
+ "description": "Shared eslint config for Typescript Libraries used at @inrupt",
4
+ "version": "2.4.0",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "main": "index.js",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/inrupt/typescript-sdk-tools.git"
12
+ },
13
+ "keywords": [
14
+ "eslint",
15
+ "inrupt"
16
+ ],
17
+ "author": "Inrupt <engineering@inrupt.com>",
18
+ "license": "MIT",
19
+ "bugs": {
20
+ "url": "https://github.com/inrupt/typescript-sdk-tools/issues"
21
+ },
22
+ "homepage": "https://github.com/inrupt/typescript-sdk-tools/tree/main/eslint-configs/eslint-config-lib#readme",
23
+ "dependencies": {
24
+ "@inrupt/eslint-config-base": "file:../eslint-config-base",
25
+ "@typescript-eslint/eslint-plugin": "^6.6.0",
26
+ "@typescript-eslint/parser": "^6.6.0",
27
+ "typescript": ">=5.2.2"
28
+ }
29
+ }