@atomicsmash/coding-standards 17.0.3-beta.0 → 18.0.0-beta.10
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 +106 -0
- package/dist/cspell/index.d.ts +15 -0
- package/dist/cspell/index.d.ts.map +1 -0
- package/dist/cspell/index.js +133 -0
- package/dist/eslint/index.d.ts +4 -0
- package/dist/eslint/index.d.ts.map +1 -0
- package/dist/eslint/index.js +199 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/prettier/index.d.ts +13 -0
- package/dist/prettier/index.d.ts.map +1 -0
- package/dist/prettier/index.js +32 -0
- package/dist/stylelint/base.d.ts +69 -0
- package/dist/stylelint/base.d.ts.map +1 -0
- package/dist/stylelint/base.js +86 -0
- package/dist/stylelint/classic.d.ts +69 -0
- package/dist/stylelint/classic.d.ts.map +1 -0
- package/dist/stylelint/classic.js +2 -0
- package/dist/stylelint/index.d.ts +161 -0
- package/dist/stylelint/index.d.ts.map +1 -0
- package/dist/stylelint/index.js +4 -0
- package/dist/stylelint/tailwind.d.ts +21 -0
- package/dist/stylelint/tailwind.d.ts.map +1 -0
- package/dist/stylelint/tailwind.js +38 -0
- package/dist/stylelint/theme-json.d.ts +73 -0
- package/dist/stylelint/theme-json.d.ts.map +1 -0
- package/dist/stylelint/theme-json.js +169 -0
- package/package.json +55 -7
- package/typescript/base.json +6 -3
- package/typescript/cypress.json +1 -1
- package/.eslintrc.cjs +0 -8
- package/beta/README.md +0 -3
- package/cspell/index.cjs +0 -142
- package/cspell/index.js +0 -1
- package/cspell/index.mjs +0 -142
- package/index.d.ts +0 -7
- package/index.js +0 -5
- package/index.mjs +0 -4
- package/prettier/index.cjs +0 -35
- package/prettier/index.js +0 -1
- package/prettier/index.mjs +0 -35
- package/stylelint/base.cjs +0 -91
- package/stylelint/base.js +0 -1
- package/stylelint/base.mjs +0 -91
- package/stylelint/classic.cjs +0 -3
- package/stylelint/classic.js +0 -1
- package/stylelint/classic.mjs +0 -2
- package/stylelint/index.cjs +0 -5
- package/stylelint/index.mjs +0 -4
- package/stylelint/tailwind.cjs +0 -38
- package/stylelint/tailwind.js +0 -1
- package/stylelint/tailwind.mjs +0 -38
- package/stylelint/theme-json.cjs +0 -189
- package/stylelint/theme-json.js +0 -1
- package/stylelint/theme-json.mjs +0 -189
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,111 @@
|
|
|
1
1
|
# @atomicsmash/coding-standards
|
|
2
2
|
|
|
3
|
+
## 18.0.0-beta.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#557](https://github.com/AtomicSmash/packages/pull/557) [`7252b22`](https://github.com/AtomicSmash/packages/commit/7252b22708d424098ffc1d673b4a420f6cb721e5) Thanks [@mikeybinns](https://github.com/mikeybinns)! - fix module resolution for import rules
|
|
8
|
+
|
|
9
|
+
- Updated dependencies []:
|
|
10
|
+
- @atomicsmash/browserslist-config@18.0.0-beta.10
|
|
11
|
+
|
|
12
|
+
## 18.0.0-beta.9
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#555](https://github.com/AtomicSmash/packages/pull/555) [`26399d1`](https://github.com/AtomicSmash/packages/commit/26399d1cc021f02740d2a2f435c4850227b24f96) Thanks [@mikeybinns](https://github.com/mikeybinns)! - fix incorrect @eslint/js dep version
|
|
17
|
+
|
|
18
|
+
- Updated dependencies []:
|
|
19
|
+
- @atomicsmash/browserslist-config@18.0.0-beta.9
|
|
20
|
+
|
|
21
|
+
## 18.0.0-beta.8
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- [#553](https://github.com/AtomicSmash/packages/pull/553) [`f5f0051`](https://github.com/AtomicSmash/packages/commit/f5f0051589f88fda628c714112c2c297cd8ced76) Thanks [@mikeybinns](https://github.com/mikeybinns)! - Fix ESLint config exports
|
|
26
|
+
|
|
27
|
+
- Updated dependencies []:
|
|
28
|
+
- @atomicsmash/browserslist-config@18.0.0-beta.8
|
|
29
|
+
|
|
30
|
+
## 18.0.0-beta.7
|
|
31
|
+
|
|
32
|
+
### Major Changes
|
|
33
|
+
|
|
34
|
+
- [#548](https://github.com/AtomicSmash/packages/pull/548) [`3cbb8b8`](https://github.com/AtomicSmash/packages/commit/3cbb8b8b7b1e588a30786cae9f4675ebcf143492) Thanks [@mikeybinns](https://github.com/mikeybinns)! - Remove AS ESLint config package as an automatic peer dependency to avoid conflicts with new config
|
|
35
|
+
|
|
36
|
+
- [#548](https://github.com/AtomicSmash/packages/pull/548) [`3cbb8b8`](https://github.com/AtomicSmash/packages/commit/3cbb8b8b7b1e588a30786cae9f4675ebcf143492) Thanks [@mikeybinns](https://github.com/mikeybinns)! - Convert configs to typescript and use proper exports setup
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- [#548](https://github.com/AtomicSmash/packages/pull/548) [`3cbb8b8`](https://github.com/AtomicSmash/packages/commit/3cbb8b8b7b1e588a30786cae9f4675ebcf143492) Thanks [@mikeybinns](https://github.com/mikeybinns)! - Update deps
|
|
41
|
+
|
|
42
|
+
- Updated dependencies []:
|
|
43
|
+
- @atomicsmash/browserslist-config@18.0.0-beta.7
|
|
44
|
+
|
|
45
|
+
## 18.0.0-beta.6
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- [#544](https://github.com/AtomicSmash/packages/pull/544) [`8e4a0b7`](https://github.com/AtomicSmash/packages/commit/8e4a0b75e2d007c67dd6db0aa8d66d055b62f39e) Thanks [@mikeybinns](https://github.com/mikeybinns)! - More changes to eslint beta config
|
|
50
|
+
|
|
51
|
+
- Updated dependencies []:
|
|
52
|
+
- @atomicsmash/eslint-config@18.0.0-beta.6
|
|
53
|
+
- @atomicsmash/browserslist-config@18.0.0-beta.6
|
|
54
|
+
|
|
55
|
+
## 18.0.0-beta.5
|
|
56
|
+
|
|
57
|
+
### Patch Changes
|
|
58
|
+
|
|
59
|
+
- [#542](https://github.com/AtomicSmash/packages/pull/542) [`7b60117`](https://github.com/AtomicSmash/packages/commit/7b60117254724918905e46bfc635bebc6ff7c9ad) Thanks [@mikeybinns](https://github.com/mikeybinns)! - Further fixes to the beta eslint config
|
|
60
|
+
|
|
61
|
+
- Updated dependencies []:
|
|
62
|
+
- @atomicsmash/eslint-config@18.0.0-beta.5
|
|
63
|
+
- @atomicsmash/browserslist-config@18.0.0-beta.5
|
|
64
|
+
|
|
65
|
+
## 18.0.0-beta.4
|
|
66
|
+
|
|
67
|
+
### Patch Changes
|
|
68
|
+
|
|
69
|
+
- [#540](https://github.com/AtomicSmash/packages/pull/540) [`01ebb55`](https://github.com/AtomicSmash/packages/commit/01ebb5548e71a6380b086514e091cf0f39a264d3) Thanks [@mikeybinns](https://github.com/mikeybinns)! - Fixes for new ESLint config
|
|
70
|
+
|
|
71
|
+
- Updated dependencies [[`01ebb55`](https://github.com/AtomicSmash/packages/commit/01ebb5548e71a6380b086514e091cf0f39a264d3)]:
|
|
72
|
+
- @atomicsmash/eslint-config@18.0.0-beta.4
|
|
73
|
+
- @atomicsmash/browserslist-config@18.0.0-beta.4
|
|
74
|
+
|
|
75
|
+
## 18.0.0-beta.3
|
|
76
|
+
|
|
77
|
+
### Major Changes
|
|
78
|
+
|
|
79
|
+
- [#533](https://github.com/AtomicSmash/packages/pull/533) [`7fd9db6`](https://github.com/AtomicSmash/packages/commit/7fd9db62a9359be302c865aeacf2e5dfc663c31a) Thanks [@mikeybinns](https://github.com/mikeybinns)! - Update TS base config
|
|
80
|
+
|
|
81
|
+
### Patch Changes
|
|
82
|
+
|
|
83
|
+
- Updated dependencies []:
|
|
84
|
+
- @atomicsmash/eslint-config@18.0.0-beta.3
|
|
85
|
+
- @atomicsmash/browserslist-config@18.0.0-beta.3
|
|
86
|
+
|
|
87
|
+
## 18.0.0-beta.2
|
|
88
|
+
|
|
89
|
+
### Minor Changes
|
|
90
|
+
|
|
91
|
+
- [#526](https://github.com/AtomicSmash/packages/pull/526) [`45913a9`](https://github.com/AtomicSmash/packages/commit/45913a99257aabfadec1399e0c712fb3afd5f956) Thanks [@mikeybinns](https://github.com/mikeybinns)! - Add beta flat config for ESLint
|
|
92
|
+
|
|
93
|
+
### Patch Changes
|
|
94
|
+
|
|
95
|
+
- Updated dependencies []:
|
|
96
|
+
- @atomicsmash/eslint-config@18.0.0-beta.2
|
|
97
|
+
- @atomicsmash/browserslist-config@18.0.0-beta.2
|
|
98
|
+
|
|
99
|
+
## 17.0.3-beta.1
|
|
100
|
+
|
|
101
|
+
### Patch Changes
|
|
102
|
+
|
|
103
|
+
- [#524](https://github.com/AtomicSmash/packages/pull/524) [`b7b83b5`](https://github.com/AtomicSmash/packages/commit/b7b83b5414d7e6899a5ad0805d5d47390d233a78) Thanks [@mikeybinns](https://github.com/mikeybinns)! - Dependency updates
|
|
104
|
+
|
|
105
|
+
- Updated dependencies [[`b7b83b5`](https://github.com/AtomicSmash/packages/commit/b7b83b5414d7e6899a5ad0805d5d47390d233a78)]:
|
|
106
|
+
- @atomicsmash/eslint-config@17.0.3-beta.1
|
|
107
|
+
- @atomicsmash/browserslist-config@17.0.3-beta.1
|
|
108
|
+
|
|
3
109
|
## 17.0.3-beta.0
|
|
4
110
|
|
|
5
111
|
### Patch Changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare const config: {
|
|
2
|
+
language: string;
|
|
3
|
+
words: string[];
|
|
4
|
+
languageSettings: ({
|
|
5
|
+
languageId: string;
|
|
6
|
+
locale: string;
|
|
7
|
+
dictionaries?: undefined;
|
|
8
|
+
} | {
|
|
9
|
+
languageId: string;
|
|
10
|
+
locale: string;
|
|
11
|
+
dictionaries: string[];
|
|
12
|
+
})[];
|
|
13
|
+
};
|
|
14
|
+
export default config;
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cspell/index.ts"],"names":[],"mappings":"AA+FA,QAAA,MAAM,MAAM;;;;;;;;;;;;CA0DkB,CAAC;AAC/B,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "fs";
|
|
2
|
+
import { resolve, dirname, join } from "path";
|
|
3
|
+
/**
|
|
4
|
+
* Search for `package.json`
|
|
5
|
+
*/
|
|
6
|
+
function findNearestPackageJson(from) {
|
|
7
|
+
from = resolve(from);
|
|
8
|
+
const parent = dirname(from);
|
|
9
|
+
if (!from || parent === from) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const pkg = join(from, "package.json");
|
|
13
|
+
if (existsSync(pkg)) {
|
|
14
|
+
return pkg;
|
|
15
|
+
}
|
|
16
|
+
return findNearestPackageJson(parent);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Load the nearest package.json
|
|
20
|
+
*/
|
|
21
|
+
function loadPackageJson(cwd) {
|
|
22
|
+
const pkgFile = findNearestPackageJson(cwd);
|
|
23
|
+
if (!pkgFile)
|
|
24
|
+
return null;
|
|
25
|
+
const packageJson = JSON.parse(readFileSync(pkgFile, "utf-8"));
|
|
26
|
+
if (typeof packageJson === "object" && packageJson !== null) {
|
|
27
|
+
return packageJson;
|
|
28
|
+
}
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
function determinePackageNamesAndMethods(cwd = process.cwd()) {
|
|
32
|
+
const packageImport = loadPackageJson(cwd) ?? {};
|
|
33
|
+
const packageNames = Object.keys(("dependencies" in packageImport && packageImport.dependencies) ?? {}).concat(Object.keys(("devDependencies" in packageImport && packageImport.devDependencies) ??
|
|
34
|
+
{}));
|
|
35
|
+
return { packageNames };
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Search for `composer.json`
|
|
39
|
+
*/
|
|
40
|
+
function findNearestComposerJson(from) {
|
|
41
|
+
from = resolve(from);
|
|
42
|
+
const parent = dirname(from);
|
|
43
|
+
if (!from || parent === from) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const composerJsonPath = join(from, "composer.json");
|
|
47
|
+
if (existsSync(composerJsonPath)) {
|
|
48
|
+
return composerJsonPath;
|
|
49
|
+
}
|
|
50
|
+
return findNearestComposerJson(parent);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Load the nearest composer.json
|
|
54
|
+
*/
|
|
55
|
+
function loadComposer(cwd) {
|
|
56
|
+
const composerJsonFile = findNearestComposerJson(cwd);
|
|
57
|
+
if (!composerJsonFile)
|
|
58
|
+
return;
|
|
59
|
+
const composerJson = JSON.parse(readFileSync(composerJsonFile, "utf-8"));
|
|
60
|
+
if (typeof composerJson === "object" && composerJson !== null) {
|
|
61
|
+
return composerJson;
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
function determineComposerPackageNamesAndMethods(cwd = process.cwd()) {
|
|
66
|
+
const packageImport = loadComposer(cwd) ?? {};
|
|
67
|
+
const packageNames = Object.keys(("require" in packageImport && packageImport.require) ?? {})
|
|
68
|
+
.concat(Object.keys(("require-dev" in packageImport && packageImport["require-dev"]) ?? {}))
|
|
69
|
+
.reduce((allowedWords, packageName) => {
|
|
70
|
+
return [...allowedWords, ...packageName.split("/")];
|
|
71
|
+
}, []);
|
|
72
|
+
return { packageNames };
|
|
73
|
+
}
|
|
74
|
+
const config = {
|
|
75
|
+
language: "en-GB",
|
|
76
|
+
words: [
|
|
77
|
+
...[
|
|
78
|
+
...determinePackageNamesAndMethods().packageNames,
|
|
79
|
+
...determineComposerPackageNamesAndMethods().packageNames,
|
|
80
|
+
"commitlint",
|
|
81
|
+
"sass",
|
|
82
|
+
"Userback",
|
|
83
|
+
"phpcs",
|
|
84
|
+
"phpcbf",
|
|
85
|
+
], // package and language names
|
|
86
|
+
...["tsbuildinfo", "svgs"], // filenames
|
|
87
|
+
...["combobox", "spinbutton"], // accessible roles
|
|
88
|
+
...["popover", "dialog"], // custom element names
|
|
89
|
+
...["atomicsmash"], // company all lowercase
|
|
90
|
+
...["unstringified", "formattable", "keyof", "nonnullable", "hidable"], // coding actions
|
|
91
|
+
...[
|
|
92
|
+
"alignfull",
|
|
93
|
+
"alignleft",
|
|
94
|
+
"alignright",
|
|
95
|
+
"muplugin",
|
|
96
|
+
"textdomain",
|
|
97
|
+
"color", // For in theme.json
|
|
98
|
+
"gfield", // Gravity Forms field class
|
|
99
|
+
"phpmailer",
|
|
100
|
+
"WPMDB", // WP Migrate DB
|
|
101
|
+
"shortcode",
|
|
102
|
+
"wp_kses",
|
|
103
|
+
"sprintf", // For @wordpress/i18n
|
|
104
|
+
], // WordPress stuff
|
|
105
|
+
],
|
|
106
|
+
languageSettings: [
|
|
107
|
+
{
|
|
108
|
+
languageId: "*",
|
|
109
|
+
locale: "en-GB",
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
languageId: "css, less, scss, sass",
|
|
113
|
+
locale: "en-US",
|
|
114
|
+
dictionaries: ["css"],
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
languageId: "javascript,typescript,javascriptreact,typescriptreact",
|
|
118
|
+
locale: "en-GB",
|
|
119
|
+
dictionaries: ["typescript"],
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
languageId: "php",
|
|
123
|
+
locale: "en-GB",
|
|
124
|
+
dictionaries: ["php", "html"],
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
languageId: "html,vue-html,javascriptreact,typescriptreact",
|
|
128
|
+
locale: "en-GB",
|
|
129
|
+
dictionaries: ["html"],
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
};
|
|
133
|
+
export default config;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/eslint/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAkB,MAAM,EAAE,MAAM,wBAAwB,CAAC;AA4LrE,eAAO,MAAM,gBAAgB,UAe3B,CAAC;AAEH,eAAO,MAAM,iBAAiB,UAK5B,CAAC"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
const OFF = 0;
|
|
2
|
+
const WARN = 1;
|
|
3
|
+
const ERROR = 2;
|
|
4
|
+
import { defineConfig } from "@eslint/config-helpers";
|
|
5
|
+
import js from "@eslint/js";
|
|
6
|
+
import esLintComments from "@eslint-community/eslint-plugin-eslint-comments/configs";
|
|
7
|
+
import importPlugin from "eslint-plugin-import";
|
|
8
|
+
import { default as playwrightPlugin } from "eslint-plugin-playwright";
|
|
9
|
+
import reactPlugin from "eslint-plugin-react";
|
|
10
|
+
import reactHooksPlugin from "eslint-plugin-react-hooks";
|
|
11
|
+
import globals from "globals";
|
|
12
|
+
import tseslint from "typescript-eslint";
|
|
13
|
+
const baseConfig = defineConfig({
|
|
14
|
+
name: "@atomicsmash/coding-standards/base-config",
|
|
15
|
+
files: ["**/*.js", "**/*.cjs", "**/*.mjs"],
|
|
16
|
+
extends: [
|
|
17
|
+
js.configs.recommended,
|
|
18
|
+
esLintComments.recommended,
|
|
19
|
+
importPlugin.flatConfigs.recommended,
|
|
20
|
+
],
|
|
21
|
+
languageOptions: {
|
|
22
|
+
ecmaVersion: 2022,
|
|
23
|
+
sourceType: "module",
|
|
24
|
+
globals: {
|
|
25
|
+
...globals.browser,
|
|
26
|
+
...globals.node,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
rules: {
|
|
30
|
+
"no-case-declarations": [OFF],
|
|
31
|
+
"import/order": [
|
|
32
|
+
ERROR,
|
|
33
|
+
{
|
|
34
|
+
alphabetize: {
|
|
35
|
+
order: "asc",
|
|
36
|
+
},
|
|
37
|
+
groups: [
|
|
38
|
+
"type",
|
|
39
|
+
"builtin",
|
|
40
|
+
"external",
|
|
41
|
+
"internal",
|
|
42
|
+
"parent",
|
|
43
|
+
["sibling", "index"],
|
|
44
|
+
],
|
|
45
|
+
"newlines-between": "ignore",
|
|
46
|
+
pathGroups: [],
|
|
47
|
+
pathGroupsExcludedImportTypes: [],
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
"prefer-const": [ERROR],
|
|
51
|
+
"no-var": [ERROR],
|
|
52
|
+
"import/no-duplicates": WARN,
|
|
53
|
+
"@eslint-community/eslint-comments/no-unused-disable": [ERROR],
|
|
54
|
+
"@eslint-community/eslint-comments/require-description": [
|
|
55
|
+
ERROR,
|
|
56
|
+
{ ignore: ["eslint-enable"] },
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
settings: {
|
|
60
|
+
"import/resolver": {
|
|
61
|
+
typescript: true, // This is needed even for js files because of errors with resolving subpaths.
|
|
62
|
+
node: true,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
const typescriptConfig = defineConfig([
|
|
67
|
+
{
|
|
68
|
+
name: "@atomicsmash/coding-standards/typescript-config",
|
|
69
|
+
files: ["**/*.ts", "**/*.cts", "**/*.mts"],
|
|
70
|
+
extends: [
|
|
71
|
+
baseConfig,
|
|
72
|
+
tseslint.configs.strictTypeChecked,
|
|
73
|
+
tseslint.configs.stylisticTypeChecked,
|
|
74
|
+
importPlugin.flatConfigs.typescript,
|
|
75
|
+
],
|
|
76
|
+
plugins: {
|
|
77
|
+
"@typescript-eslint": tseslint.plugin,
|
|
78
|
+
},
|
|
79
|
+
languageOptions: {
|
|
80
|
+
parser: tseslint.parser,
|
|
81
|
+
parserOptions: {
|
|
82
|
+
projectService: true,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
rules: {
|
|
86
|
+
"@typescript-eslint/naming-convention": [
|
|
87
|
+
ERROR,
|
|
88
|
+
{
|
|
89
|
+
selector: "variableLike",
|
|
90
|
+
format: ["camelCase", "PascalCase", "UPPER_CASE"],
|
|
91
|
+
leadingUnderscore: "allow",
|
|
92
|
+
},
|
|
93
|
+
{ selector: "function", format: ["camelCase", "PascalCase"] },
|
|
94
|
+
{ selector: "typeLike", format: ["PascalCase"] },
|
|
95
|
+
{
|
|
96
|
+
selector: "variable",
|
|
97
|
+
types: ["boolean"],
|
|
98
|
+
format: ["PascalCase"],
|
|
99
|
+
prefix: ["is", "should", "has", "can", "did", "will", "are"],
|
|
100
|
+
leadingUnderscore: "allow",
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
"@typescript-eslint/consistent-type-definitions": [ERROR, "type"],
|
|
104
|
+
"@typescript-eslint/non-nullable-type-assertion-style": OFF,
|
|
105
|
+
"@typescript-eslint/no-unused-vars": [
|
|
106
|
+
ERROR,
|
|
107
|
+
{
|
|
108
|
+
args: "all",
|
|
109
|
+
argsIgnorePattern: "^_",
|
|
110
|
+
caughtErrors: "all",
|
|
111
|
+
caughtErrorsIgnorePattern: "^_",
|
|
112
|
+
destructuredArrayIgnorePattern: "^_",
|
|
113
|
+
varsIgnorePattern: "^_",
|
|
114
|
+
ignoreRestSiblings: true,
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
settings: {
|
|
119
|
+
"import/resolver": {
|
|
120
|
+
typescript: true,
|
|
121
|
+
node: true,
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
]);
|
|
126
|
+
if (reactPlugin.configs.flat.recommended === undefined ||
|
|
127
|
+
reactPlugin.configs.flat["jsx-runtime"] === undefined) {
|
|
128
|
+
// Throw is needed to fix types correctly
|
|
129
|
+
// This should never happen so if it does, it's an error worthy of breaking all eslint configs.
|
|
130
|
+
throw new Error("Failed to get config from eslint-plugin-react.");
|
|
131
|
+
}
|
|
132
|
+
const sharedReactRulesAndSettings = {
|
|
133
|
+
extends: [
|
|
134
|
+
reactPlugin.configs.flat.recommended,
|
|
135
|
+
reactPlugin.configs.flat["jsx-runtime"],
|
|
136
|
+
reactHooksPlugin.configs.flat.recommended,
|
|
137
|
+
],
|
|
138
|
+
settings: {
|
|
139
|
+
react: {
|
|
140
|
+
version: "detect",
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
rules: {
|
|
144
|
+
"react-hooks/exhaustive-deps": [
|
|
145
|
+
WARN,
|
|
146
|
+
{
|
|
147
|
+
additionalHooks: "(useSelect|useSuspenseSelect)",
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
const reactConfig = defineConfig([
|
|
153
|
+
{
|
|
154
|
+
name: "@atomicsmash/coding-standards/react-config",
|
|
155
|
+
files: ["**/*.jsx"],
|
|
156
|
+
extends: [baseConfig, ...sharedReactRulesAndSettings.extends],
|
|
157
|
+
settings: {
|
|
158
|
+
...sharedReactRulesAndSettings.settings,
|
|
159
|
+
},
|
|
160
|
+
rules: {
|
|
161
|
+
...sharedReactRulesAndSettings.rules,
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
]);
|
|
165
|
+
const reactTypescriptConfig = defineConfig([
|
|
166
|
+
{
|
|
167
|
+
name: "@atomicsmash/coding-standards/react-typescript-config",
|
|
168
|
+
files: ["**/*.tsx"],
|
|
169
|
+
extends: [typescriptConfig, ...sharedReactRulesAndSettings.extends],
|
|
170
|
+
settings: {
|
|
171
|
+
...sharedReactRulesAndSettings.settings,
|
|
172
|
+
},
|
|
173
|
+
rules: {
|
|
174
|
+
...sharedReactRulesAndSettings.rules,
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
]);
|
|
178
|
+
export const playwrightConfig = defineConfig([
|
|
179
|
+
{
|
|
180
|
+
name: "@atomicsmash/coding-standards/playwright-config",
|
|
181
|
+
extends: [playwrightPlugin.configs["flat/recommended"]],
|
|
182
|
+
rules: {
|
|
183
|
+
"playwright/expect-expect": [
|
|
184
|
+
ERROR,
|
|
185
|
+
{
|
|
186
|
+
assertFunctionNames: [
|
|
187
|
+
"playAudit", // This is the lighthouse playwright test, which contains threshold assertions.
|
|
188
|
+
],
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
]);
|
|
194
|
+
export const recommendedConfig = defineConfig([
|
|
195
|
+
baseConfig,
|
|
196
|
+
typescriptConfig,
|
|
197
|
+
reactConfig,
|
|
198
|
+
reactTypescriptConfig,
|
|
199
|
+
]);
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { default as cspellConfig } from "./cspell/index.js";
|
|
2
|
+
import * as eslintConfigs from "./eslint/index.js";
|
|
3
|
+
import { default as prettierConfig } from "./prettier/index.js";
|
|
4
|
+
import { default as stylelintConfig } from "./stylelint/index.js";
|
|
5
|
+
export { cspellConfig, eslintConfigs, prettierConfig, stylelintConfig };
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,aAAa,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { default as cspellConfig } from "./cspell/index.js";
|
|
2
|
+
import * as eslintConfigs from "./eslint/index.js";
|
|
3
|
+
import { default as prettierConfig } from "./prettier/index.js";
|
|
4
|
+
import { default as stylelintConfig } from "./stylelint/index.js";
|
|
5
|
+
export { cspellConfig, eslintConfigs, prettierConfig, stylelintConfig };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prettier/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,wBAkCmB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
/* Expected defaults:
|
|
3
|
+
Prettier recommendation
|
|
4
|
+
printWidth: 80,
|
|
5
|
+
|
|
6
|
+
Single quotes are more often found in text strings (used for apostrophes) so using double quotes prevents lots of escaping characters.
|
|
7
|
+
singleQuote: false,
|
|
8
|
+
|
|
9
|
+
Keep very nested indentation near the left to prevent lots of horizontal scrolling.
|
|
10
|
+
tabWidth: 2,
|
|
11
|
+
|
|
12
|
+
Semicolons prevent AST errors and are more explicit where a line ends
|
|
13
|
+
semi: true,
|
|
14
|
+
|
|
15
|
+
Consistent line endings for MacOS and Windows
|
|
16
|
+
endOfLine: "lf",
|
|
17
|
+
*/
|
|
18
|
+
// Tabs are better for visually impaired coders https://www.reddit.com/r/javascript/comments/c8drjo/nobody_talks_about_the_real_reason_to_use_tabs/
|
|
19
|
+
useTabs: true,
|
|
20
|
+
// Helps clean up git diffs by removing changes of a single comma on a line if adding a new line to the bottom
|
|
21
|
+
trailingComma: "all",
|
|
22
|
+
overrides: [
|
|
23
|
+
{
|
|
24
|
+
// yml files require specific indentation rules
|
|
25
|
+
files: ["*.yml", "*.yaml"],
|
|
26
|
+
options: {
|
|
27
|
+
useTabs: false,
|
|
28
|
+
tabWidth: 2,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
reportDescriptionlessDisables: true;
|
|
3
|
+
reportInvalidScopeDisables: true;
|
|
4
|
+
reportNeedlessDisables: true;
|
|
5
|
+
plugins: string[];
|
|
6
|
+
rules: {
|
|
7
|
+
"custom-property-pattern": null;
|
|
8
|
+
"function-url-quotes": string[];
|
|
9
|
+
"rule-empty-line-before": (string | {
|
|
10
|
+
except: string[];
|
|
11
|
+
ignore: string[];
|
|
12
|
+
})[];
|
|
13
|
+
"comment-empty-line-before": (string | {
|
|
14
|
+
except: string[];
|
|
15
|
+
ignore: string[];
|
|
16
|
+
})[];
|
|
17
|
+
"order/order": (string | {
|
|
18
|
+
type: string;
|
|
19
|
+
hasBlock: boolean;
|
|
20
|
+
})[];
|
|
21
|
+
"plugin/no-restricted-syntax": {
|
|
22
|
+
selector: string;
|
|
23
|
+
message: string;
|
|
24
|
+
}[][];
|
|
25
|
+
"selector-class-pattern": (string | {
|
|
26
|
+
message: string;
|
|
27
|
+
})[];
|
|
28
|
+
"at-rule-empty-line-before": (string | {
|
|
29
|
+
ignore: string[];
|
|
30
|
+
})[];
|
|
31
|
+
};
|
|
32
|
+
overrides: ({
|
|
33
|
+
files: string[];
|
|
34
|
+
extends: string[];
|
|
35
|
+
rules: {
|
|
36
|
+
"at-rule-no-unknown": (boolean | {
|
|
37
|
+
ignoreAtRules: string;
|
|
38
|
+
})[];
|
|
39
|
+
"scss/operator-no-newline-after"?: undefined;
|
|
40
|
+
"no-descending-specificity"?: undefined;
|
|
41
|
+
"scss/at-rule-no-unknown"?: undefined;
|
|
42
|
+
"declaration-property-value-allowed-list"?: undefined;
|
|
43
|
+
};
|
|
44
|
+
} | {
|
|
45
|
+
files: string[];
|
|
46
|
+
extends: string[];
|
|
47
|
+
rules: {
|
|
48
|
+
"scss/operator-no-newline-after": null;
|
|
49
|
+
"no-descending-specificity": null;
|
|
50
|
+
"scss/at-rule-no-unknown": (boolean | {
|
|
51
|
+
ignoreAtRules: string;
|
|
52
|
+
})[];
|
|
53
|
+
"at-rule-no-unknown"?: undefined;
|
|
54
|
+
"declaration-property-value-allowed-list"?: undefined;
|
|
55
|
+
};
|
|
56
|
+
} | {
|
|
57
|
+
files: string[];
|
|
58
|
+
rules: {
|
|
59
|
+
"declaration-property-value-allowed-list": null;
|
|
60
|
+
"at-rule-no-unknown"?: undefined;
|
|
61
|
+
"scss/operator-no-newline-after"?: undefined;
|
|
62
|
+
"no-descending-specificity"?: undefined;
|
|
63
|
+
"scss/at-rule-no-unknown"?: undefined;
|
|
64
|
+
};
|
|
65
|
+
extends?: undefined;
|
|
66
|
+
})[];
|
|
67
|
+
};
|
|
68
|
+
export default _default;
|
|
69
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/stylelint/base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,wBAiCmB"}
|