@atomicsmash/coding-standards 10.0.1 → 11.0.0-beta.0
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 +12 -0
- package/cspell/index.js +56 -4
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atomicsmash/coding-standards
|
|
2
2
|
|
|
3
|
+
## 11.0.0-beta.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`db462fe`](https://github.com/AtomicSmash/packages/commit/db462fecd0ceb0a46e5bd65748f65089fa6fc2d1) Thanks [@mikeybinns](https://github.com/mikeybinns)! - Add more allowed words to cSpell config
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies []:
|
|
12
|
+
- @atomicsmash/eslint-config@11.0.0-beta.0
|
|
13
|
+
- @atomicsmash/browserslist-config@11.0.0-beta.0
|
|
14
|
+
|
|
3
15
|
## 10.0.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/cspell/index.js
CHANGED
|
@@ -25,35 +25,87 @@ function findNearestPackageJson(from) {
|
|
|
25
25
|
* @param {string} cwd
|
|
26
26
|
* @returns
|
|
27
27
|
*/
|
|
28
|
-
function
|
|
28
|
+
function loadPackageJson(cwd) {
|
|
29
29
|
const pkgFile = findNearestPackageJson(cwd);
|
|
30
30
|
if (!pkgFile) return;
|
|
31
31
|
return JSON.parse(fs.readFileSync(pkgFile, "utf-8"));
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
function determinePackageNamesAndMethods(cwd = process.cwd()) {
|
|
35
|
-
const packageImport =
|
|
35
|
+
const packageImport = loadPackageJson(cwd) || {};
|
|
36
36
|
const packageNames = Object.keys(packageImport.dependencies || {}).concat(
|
|
37
37
|
Object.keys(packageImport.devDependencies || {}),
|
|
38
38
|
);
|
|
39
39
|
return { packageNames };
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Search for `composer.json`
|
|
44
|
+
* @param {string} from - search `from` directory.
|
|
45
|
+
* @returns {string|void} - path to composer.json
|
|
46
|
+
*/
|
|
47
|
+
function findNearestComposerJson(from) {
|
|
48
|
+
from = path.resolve(from);
|
|
49
|
+
const parent = path.dirname(from);
|
|
50
|
+
if (!from || parent === from) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const composerJsonPath = path.join(from, "composer.json");
|
|
55
|
+
if (fs.existsSync(composerJsonPath)) {
|
|
56
|
+
return composerJsonPath;
|
|
57
|
+
}
|
|
58
|
+
return findNearestComposerJson(parent);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Load the nearest composer.json
|
|
63
|
+
* @param {string} cwd
|
|
64
|
+
* @returns
|
|
65
|
+
*/
|
|
66
|
+
function loadComposer(cwd) {
|
|
67
|
+
const composerJsonFile = findNearestComposerJson(cwd);
|
|
68
|
+
if (!composerJsonFile) return;
|
|
69
|
+
return JSON.parse(fs.readFileSync(composerJsonFile, "utf-8"));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function determineComposerPackageNamesAndMethods(cwd = process.cwd()) {
|
|
73
|
+
const packageImport = loadComposer(cwd) || {};
|
|
74
|
+
const packageNames = Object.keys(packageImport.require || {})
|
|
75
|
+
.concat(Object.keys(packageImport["require-dev"] || {}))
|
|
76
|
+
.reduce((allowedWords, packageName) => {
|
|
77
|
+
return [...allowedWords, ...packageName.split("/")];
|
|
78
|
+
}, []);
|
|
79
|
+
return { packageNames };
|
|
80
|
+
}
|
|
81
|
+
|
|
42
82
|
/** @type { import("@cspell/cspell-types").CSpellUserSettings } */
|
|
43
83
|
const config = {
|
|
44
84
|
language: "en-GB",
|
|
45
85
|
words: [
|
|
46
86
|
...[
|
|
47
87
|
...determinePackageNamesAndMethods().packageNames,
|
|
88
|
+
...determineComposerPackageNamesAndMethods().packageNames,
|
|
48
89
|
"commitlint",
|
|
49
90
|
"sass",
|
|
50
91
|
"Userback",
|
|
92
|
+
"phpcs",
|
|
93
|
+
"phpcbf",
|
|
51
94
|
], // package and language names
|
|
52
|
-
...["tsbuildinfo"], // filenames
|
|
95
|
+
...["tsbuildinfo", "svgs"], // filenames
|
|
53
96
|
...["combobox", "spinbutton"], // accessible roles
|
|
54
97
|
...["popover", "dialog"], // custom element names
|
|
55
98
|
...["atomicsmash"], // company all lowercase
|
|
56
|
-
...["unstringified", "formattable", "keyof", "nonnullable"], // coding actions
|
|
99
|
+
...["unstringified", "formattable", "keyof", "nonnullable", "hidable"], // coding actions
|
|
100
|
+
...[
|
|
101
|
+
"alignfull",
|
|
102
|
+
"alignleft",
|
|
103
|
+
"alignright",
|
|
104
|
+
"muplugin",
|
|
105
|
+
"textdomain",
|
|
106
|
+
"color", // For in theme.json
|
|
107
|
+
"gfield", // Gravity Forms field class
|
|
108
|
+
], // WordPress stuff
|
|
57
109
|
],
|
|
58
110
|
languageSettings: [
|
|
59
111
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atomicsmash/coding-standards",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0-beta.0",
|
|
4
4
|
"description": "A collection of coding standards configurations.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"@cspell/cspell-types": "^8.6.0"
|
|
9
9
|
},
|
|
10
10
|
"peerDependencies": {
|
|
11
|
-
"@atomicsmash/browserslist-config": "
|
|
12
|
-
"@atomicsmash/eslint-config": "
|
|
11
|
+
"@atomicsmash/browserslist-config": "11.0.0-beta.0",
|
|
12
|
+
"@atomicsmash/eslint-config": "11.0.0-beta.0",
|
|
13
13
|
"@commitlint/cli": "^19.0.3",
|
|
14
14
|
"@commitlint/config-conventional": "^19.0.3",
|
|
15
15
|
"prettier": "^3.2.5"
|