|
| 1 | +import js from "@eslint/js"; |
| 2 | +import globals from "globals"; |
| 3 | +import jsoncPlugin from "eslint-plugin-jsonc"; |
| 4 | +import * as jsoncParser from "jsonc-eslint-parser"; |
| 5 | + |
| 6 | +export default [ |
| 7 | + js.configs.recommended, |
| 8 | + { |
| 9 | + languageOptions: { |
| 10 | + ecmaVersion: 2022, |
| 11 | + sourceType: "module", |
| 12 | + globals: { |
| 13 | + ...globals.node, |
| 14 | + }, |
| 15 | + }, |
| 16 | + rules: { |
| 17 | + "brace-style": ["warn", "stroustrup", { allowSingleLine: true }], |
| 18 | + "func-call-spacing": ["warn", "never"], |
| 19 | + indent: ["warn", "tab", { ignoredNodes: ["TemplateLiteral *"], SwitchCase: 1 }], |
| 20 | + "linebreak-style": ["warn", "unix"], |
| 21 | + "no-console": ["warn", { allow: ["warn", "error"] }], |
| 22 | + quotes: ["warn", "double"], |
| 23 | + semi: ["warn", "always"], |
| 24 | + "space-before-blocks": ["warn", "always"], |
| 25 | + }, |
| 26 | + }, |
| 27 | + { |
| 28 | + files: ["**/*.json"], |
| 29 | + plugins: { jsonc: jsoncPlugin }, |
| 30 | + languageOptions: { parser: jsoncParser }, |
| 31 | + rules: { |
| 32 | + ...jsoncPlugin.configs["recommended-with-jsonc"].rules, |
| 33 | + }, |
| 34 | + }, |
| 35 | + { |
| 36 | + files: ["package.json"], |
| 37 | + rules: { |
| 38 | + "jsonc/sort-keys": [ |
| 39 | + "warn", |
| 40 | + { |
| 41 | + pathPattern: "^$", |
| 42 | + order: [ |
| 43 | + "$schema", |
| 44 | + "private", |
| 45 | + "name", |
| 46 | + "version", |
| 47 | + "description", |
| 48 | + "license", |
| 49 | + "author", |
| 50 | + "maintainers", |
| 51 | + "contributors", |
| 52 | + "homepage", |
| 53 | + "repository", |
| 54 | + "bugs", |
| 55 | + "type", |
| 56 | + "exports", |
| 57 | + "main", |
| 58 | + "module", |
| 59 | + "browser", |
| 60 | + "man", |
| 61 | + "preferGlobal", |
| 62 | + "bin", |
| 63 | + "files", |
| 64 | + "directories", |
| 65 | + "scripts", |
| 66 | + "config", |
| 67 | + "sideEffects", |
| 68 | + "types", |
| 69 | + "typings", |
| 70 | + "workspaces", |
| 71 | + "resolutions", |
| 72 | + "dependencies", |
| 73 | + "bundleDependencies", |
| 74 | + "bundledDependencies", |
| 75 | + "peerDependencies", |
| 76 | + "peerDependenciesMeta", |
| 77 | + "optionalDependencies", |
| 78 | + "devDependencies", |
| 79 | + "keywords", |
| 80 | + "engines", |
| 81 | + "engineStrict", |
| 82 | + "os", |
| 83 | + "cpu", |
| 84 | + "publishConfig", |
| 85 | + ], |
| 86 | + }, |
| 87 | + { |
| 88 | + pathPattern: "^repository$", |
| 89 | + order: ["type", "url", "directory"], |
| 90 | + }, |
| 91 | + { |
| 92 | + pathPattern: "^spectrum$", |
| 93 | + order: { type: "asc" }, |
| 94 | + }, |
| 95 | + { |
| 96 | + pathPattern: "^exports$", |
| 97 | + order: ["."], |
| 98 | + }, |
| 99 | + { |
| 100 | + pathPattern: ".*", |
| 101 | + order: { type: "asc" }, |
| 102 | + }, |
| 103 | + ], |
| 104 | + }, |
| 105 | + }, |
| 106 | +]; |
0 commit comments