@metamask-previews/oxlint-config-nodejs 0.0.0-preview-d6c6adc

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 ADDED
@@ -0,0 +1,10 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ [Unreleased]: https://github.com/MetaMask/oxlint-config/
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 MetaMask
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # `@metamask/oxlint-config-nodejs`
2
+
3
+ MetaMask's [Node.js](https://nodejs.org) Oxlint configuration.
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ yarn add --dev \
9
+ @metamask/oxlint-config@^0.0.0 \
10
+ @metamask/oxlint-config-nodejs@^0.0.0 \
11
+ oxlint@^1.82.0
12
+ ```
13
+
14
+ The order in which you extend ESLint rules matters.
15
+ The `@metamask/*` Oxlint configs should be added to the config array _last_,
16
+ with `@metamask/oxlint-config` first, and `@metamask/oxlint-config-*` in any
17
+ order thereafter.
18
+
19
+ ```js
20
+ import base, { createConfig } from '@metamask/oxlint-config';
21
+ import nodejs from '@metamask/oxlint-config-nodejs';
22
+
23
+ const config = createConfig({
24
+ extends: [
25
+ // Any custom shared config should be added here.
26
+ // ...
27
+
28
+ // This should be added last unless you know what you're doing.
29
+ base,
30
+ nodejs,
31
+ ],
32
+ });
33
+ ```
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@metamask-previews/oxlint-config-nodejs",
3
+ "version": "0.0.0-preview-d6c6adc",
4
+ "description": "Shareable MetaMask Oxlint config for Node.js",
5
+ "homepage": "https://github.com/MetaMask/oxlint-config#readme",
6
+ "bugs": {
7
+ "url": "https://github.com/MetaMask/oxlint-config/issues"
8
+ },
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/MetaMask/oxlint-config.git"
13
+ },
14
+ "files": [
15
+ "src/",
16
+ "!src/**/*.test.js"
17
+ ],
18
+ "type": "module",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./src/index.d.ts",
22
+ "default": "./src/index.js"
23
+ }
24
+ },
25
+ "publishConfig": {
26
+ "access": "public",
27
+ "registry": "https://registry.npmjs.org/"
28
+ },
29
+ "scripts": {
30
+ "changelog:update": "../../scripts/update-changelog.sh @metamask/oxlint-config-nodejs",
31
+ "changelog:validate": "../../scripts/validate-changelog.sh @metamask/oxlint-config-nodejs",
32
+ "test": "oxlint ."
33
+ },
34
+ "devDependencies": {
35
+ "@metamask/auto-changelog": "^3.4.4",
36
+ "@metamask/oxlint-config": "^0.0.0",
37
+ "oxlint": "^1.82.0",
38
+ "vitest": "^2.1.9"
39
+ },
40
+ "peerDependencies": {
41
+ "@metamask/oxlint-config": "^0.0.0",
42
+ "oxlint": "^1.82.0"
43
+ },
44
+ "engines": {
45
+ "node": "^18.18 || >=20"
46
+ }
47
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import { OxlintConfig } from 'oxlint';
2
+
3
+ declare const config: OxlintConfig;
4
+ export default config;
package/src/index.js ADDED
@@ -0,0 +1,30 @@
1
+ import { createConfig } from '@metamask/oxlint-config';
2
+
3
+ const config = createConfig({
4
+ plugins: ['node'],
5
+
6
+ categories: {
7
+ correctness: 'allow',
8
+ },
9
+
10
+ rules: {
11
+ // Possible Errors
12
+ 'node/handle-callback-err': ['error', '^(err|error)$'],
13
+ 'node/no-new-require': 'error',
14
+ 'node/no-path-concat': 'error',
15
+
16
+ // Stylistic rules
17
+ 'node/callback-return': 'error',
18
+ 'node/exports-style': 'error',
19
+ 'node/global-require': 'error',
20
+ 'node/no-mixed-requires': 'error',
21
+ 'node/no-process-env': 'error',
22
+ 'node/no-sync': 'error',
23
+
24
+ // Enabled in the base config, but this should be allowed in Node.js
25
+ // projects.
26
+ 'import/no-nodejs-modules': 'off',
27
+ },
28
+ });
29
+
30
+ export default config;