@atomicsmash/coding-standards 13.0.0-beta.2 → 13.0.0-beta.4

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 CHANGED
@@ -1,5 +1,33 @@
1
1
  # @atomicsmash/coding-standards
2
2
 
3
+ ## 13.0.0-beta.4
4
+
5
+ ### Minor Changes
6
+
7
+ - [#284](https://github.com/AtomicSmash/packages/pull/284) [`32b0b32`](https://github.com/AtomicSmash/packages/commit/32b0b327c8accfc5e4974d81218580ac1bc9b773) Thanks [@mikeybinns](https://github.com/mikeybinns)! - Add ESM versions of all coding standards js files, deprecate CJS versions
8
+
9
+ - [#284](https://github.com/AtomicSmash/packages/pull/284) [`9aba864`](https://github.com/AtomicSmash/packages/commit/9aba864489becfcc1c43d0a25bc414d19350dc96) Thanks [@mikeybinns](https://github.com/mikeybinns)! - Revert "Install PHP CS rules via npm" in favour of composer package, deprecate PHP config.
10
+
11
+ - [#284](https://github.com/AtomicSmash/packages/pull/284) [`8a0d915`](https://github.com/AtomicSmash/packages/commit/8a0d9153b4fab6f4fc3aa2b10e7ad301706c4578) Thanks [@mikeybinns](https://github.com/mikeybinns)! - Deprecate commitlint config
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [[`451112c`](https://github.com/AtomicSmash/packages/commit/451112c2a03605f856aa04f7a681565b1d0c2c2b)]:
16
+ - @atomicsmash/eslint-config@13.0.0-beta.4
17
+ - @atomicsmash/browserslist-config@13.0.0-beta.4
18
+
19
+ ## 13.0.0-beta.3
20
+
21
+ ### Minor Changes
22
+
23
+ - [#280](https://github.com/AtomicSmash/packages/pull/280) [`46e983b`](https://github.com/AtomicSmash/packages/commit/46e983bdf437f385200dfed23b2500209434416e) Thanks [@steve-brett](https://github.com/steve-brett)! - Install PHP CS rules via npm
24
+
25
+ ### Patch Changes
26
+
27
+ - Updated dependencies []:
28
+ - @atomicsmash/eslint-config@13.0.0-beta.3
29
+ - @atomicsmash/browserslist-config@13.0.0-beta.3
30
+
3
31
  ## 13.0.0-beta.2
4
32
 
5
33
  ### Minor Changes
package/MIGRATING.md CHANGED
@@ -2,41 +2,91 @@
2
2
 
3
3
  This document contains information on how to migrate from one version to the next version.
4
4
 
5
- ## v8 --> v9
5
+ ## v12 --> v13
6
6
 
7
- All dependencies were changed to peer dependencies. You may need to explicitly install the packages if they are not installed automatically for you:
7
+ ### Stabilise stylelint config
8
8
 
9
- ```sh
10
- npm install --save-dev @atomicsmash/eslint-config @atomicsmash/browserslist-config prettier @commitlint/cli @commitlint/config-conventional
9
+ - If you were previously using the stylelint beta config, this has now been stabilised. You must update the beta file reference to the stable one.
10
+
11
+ ```ts
12
+ const stylelintConfig = require("@atomicsmash/coding-standards/beta/stylelint/classic");
13
+ // becomes
14
+ const stylelintConfig = require("@atomicsmash/coding-standards/stylelint/classic");
15
+ // or
16
+ const stylelintConfig = require("@atomicsmash/coding-standards").stylelintConfig
17
+ .classic;
11
18
  ```
12
19
 
13
- Please note that the peer dependency for the ESLint config and Browserslist config is strict. You must install the same version number as the coding standards package.
20
+ ### PHP coding standards have moved to another package, so the config in this package is deprecated.
14
21
 
15
- ## v9 --> v10
22
+ - To ensure that all dependencies are managed correctly and efficiently, the php coding standards have been moved to a composer package.
23
+ - Keep this package installed unless you are only using it for the PHP standards
24
+ - Remove all php coding standards dependencies:
16
25
 
17
- We have stabilised the PHPCS config. If you were previously referencing this file, you must target the new stable config.
18
-
19
- ```
20
- <rule ref="./node_modules/@atomicsmash/coding-standards/beta/phpcs/phpcs.xml"/>
26
+ ```sh
27
+ composer remove --dev squizlabs/php_codesniffer wp-coding-standards/wpcs dealerdirect/phpcodesniffer-composer-installer sirbrillig/phpcs-variable-analysis phpcompatibility/phpcompatibility-wp slevomat/coding-standard
21
28
  ```
22
29
 
23
- becomes:
30
+ - Install the new composer package as a dev dependency `composer require --dev atomicsmash/php-coding-standards`
31
+ - Update the import path of the xml file from the node package to the composer package:
24
32
 
25
- ```
33
+ ```xml
26
34
  <rule ref="./node_modules/@atomicsmash/coding-standards/phpcs/phpcs.xml"/>
35
+ <!-- Becomes -->
36
+ <rule ref="./vendor/atomicsmash/php-coding-standards/phpcs.xml"/>
27
37
  ```
28
38
 
29
- ## v10 --> v11
39
+ ### Commitlint config is now deprecated and will be removed in a future version.
30
40
 
31
- No breaking changes (this shouldn't have been a major release).
41
+ - With our move to changesets internally, it's no longer required to lint commits.
42
+ - You should remove commitlint from your project, at which point this config is no longer needed.
43
+ - The config will be removed in the next version
44
+
45
+ ### ESM versions of all scripts have been added, and CJS versions are now deprecated.
46
+
47
+ - The scripts will continue to work in this version as is
48
+ - In the next version, the .js files will be updated to point to the ESM versions instead of the commonjs version.
49
+ - If you can't migrate to ESM, update the imports to pull directly from the cjs versions. This will only be a temporary fix for now, as they will be removed in later versions, but all the packages we export configs for support ESM configs.
50
+ - This is done in an effort to make updating ESLint to the new config easier.
51
+ - An ESM import of commitlint has not been added because it's planned to be removed.
32
52
 
33
53
  ## v11 --> v12
34
54
 
35
- Remove usage of vitest typescript config
55
+ ### Remove usage of vitest typescript config
36
56
 
37
57
  - This config was only adding vitest global types, however, in practice, this caused more errors in some cases. It’s better to import functions when needed instead of using globals, so this config is removed. If you are using this, simply remove the config from your tsconfig and switch to using imports for your test functions.
38
58
 
39
- Add comments to your eslint disables
59
+ ### Add comments to your eslint disables
40
60
 
41
61
  - We added linting for ESLint comments. It helps avoid things like unnecessary disables, and requires every disable to have a message explaining why you’ve disabled the rule.
42
62
  - Marked as breaking as this will likely add new errors to your code, especially if you have used eslint-disables.
63
+
64
+ ## v10 --> v11
65
+
66
+ No breaking changes (this shouldn't have been a major release).
67
+
68
+ ## v9 --> v10
69
+
70
+ ### We have stabilised the PHPCS config.
71
+ - If you were previously referencing this file, you must target the new stable config.
72
+
73
+ ```
74
+ <rule ref="./node_modules/@atomicsmash/coding-standards/beta/phpcs/phpcs.xml"/>
75
+ ```
76
+
77
+ becomes:
78
+
79
+ ```
80
+ <rule ref="./node_modules/@atomicsmash/coding-standards/phpcs/phpcs.xml"/>
81
+ ```
82
+
83
+ ## v8 --> v9
84
+
85
+ ### All dependencies were changed to peer dependencies.
86
+ - You may need to explicitly install the packages if they are not installed automatically for you:
87
+
88
+ ```sh
89
+ npm install --save-dev @atomicsmash/eslint-config @atomicsmash/browserslist-config prettier @commitlint/cli @commitlint/config-conventional
90
+ ```
91
+
92
+ Please note that the peer dependency for the ESLint config and Browserslist config is strict. You must install the same version number as the coding standards package.
@@ -0,0 +1,142 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+
4
+ /**
5
+ * Search for `package.json`
6
+ * @param {string} from - search `from` directory.
7
+ * @returns {string|void} - path to package.json
8
+ */
9
+ function findNearestPackageJson(from) {
10
+ from = path.resolve(from);
11
+ const parent = path.dirname(from);
12
+ if (!from || parent === from) {
13
+ return;
14
+ }
15
+
16
+ const pkg = path.join(from, "package.json");
17
+ if (fs.existsSync(pkg)) {
18
+ return pkg;
19
+ }
20
+ return findNearestPackageJson(parent);
21
+ }
22
+
23
+ /**
24
+ * Load the nearest package.json
25
+ * @param {string} cwd
26
+ * @returns
27
+ */
28
+ function loadPackageJson(cwd) {
29
+ const pkgFile = findNearestPackageJson(cwd);
30
+ if (!pkgFile) return;
31
+ return JSON.parse(fs.readFileSync(pkgFile, "utf-8"));
32
+ }
33
+
34
+ function determinePackageNamesAndMethods(cwd = process.cwd()) {
35
+ const packageImport = loadPackageJson(cwd) || {};
36
+ const packageNames = Object.keys(packageImport.dependencies || {}).concat(
37
+ Object.keys(packageImport.devDependencies || {}),
38
+ );
39
+ return { packageNames };
40
+ }
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
+
82
+ /** @type { import("@cspell/cspell-types").CSpellUserSettings } */
83
+ const config = {
84
+ language: "en-GB",
85
+ words: [
86
+ ...[
87
+ ...determinePackageNamesAndMethods().packageNames,
88
+ ...determineComposerPackageNamesAndMethods().packageNames,
89
+ "commitlint",
90
+ "sass",
91
+ "Userback",
92
+ "phpcs",
93
+ "phpcbf",
94
+ ], // package and language names
95
+ ...["tsbuildinfo", "svgs"], // filenames
96
+ ...["combobox", "spinbutton"], // accessible roles
97
+ ...["popover", "dialog"], // custom element names
98
+ ...["atomicsmash"], // company all lowercase
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
+ "phpmailer",
109
+ "WPMDB", // WP Migrate DB
110
+ "shortcode",
111
+ "wp_kses",
112
+ "sprintf", // For @wordpress/i18n
113
+ ], // WordPress stuff
114
+ ],
115
+ languageSettings: [
116
+ {
117
+ languageId: "*",
118
+ locale: "en-GB",
119
+ },
120
+ {
121
+ languageId: "css, less, scss, sass",
122
+ locale: "en-US",
123
+ dictionaries: ["css"],
124
+ },
125
+ {
126
+ languageId: "javascript,typescript,javascriptreact,typescriptreact",
127
+ locale: "en-GB",
128
+ dictionaries: ["typescript"],
129
+ },
130
+ {
131
+ languageId: "php",
132
+ locale: "en-GB",
133
+ dictionaries: ["php", "html"],
134
+ },
135
+ {
136
+ languageId: "html,vue-html,javascriptreact,typescriptreact",
137
+ locale: "en-GB",
138
+ dictionaries: ["html"],
139
+ },
140
+ ],
141
+ };
142
+ module.exports = config;
package/cspell/index.js CHANGED
@@ -1,142 +1 @@
1
- const fs = require("fs");
2
- const path = require("path");
3
-
4
- /**
5
- * Search for `package.json`
6
- * @param {string} from - search `from` directory.
7
- * @returns {string|void} - path to package.json
8
- */
9
- function findNearestPackageJson(from) {
10
- from = path.resolve(from);
11
- const parent = path.dirname(from);
12
- if (!from || parent === from) {
13
- return;
14
- }
15
-
16
- const pkg = path.join(from, "package.json");
17
- if (fs.existsSync(pkg)) {
18
- return pkg;
19
- }
20
- return findNearestPackageJson(parent);
21
- }
22
-
23
- /**
24
- * Load the nearest package.json
25
- * @param {string} cwd
26
- * @returns
27
- */
28
- function loadPackageJson(cwd) {
29
- const pkgFile = findNearestPackageJson(cwd);
30
- if (!pkgFile) return;
31
- return JSON.parse(fs.readFileSync(pkgFile, "utf-8"));
32
- }
33
-
34
- function determinePackageNamesAndMethods(cwd = process.cwd()) {
35
- const packageImport = loadPackageJson(cwd) || {};
36
- const packageNames = Object.keys(packageImport.dependencies || {}).concat(
37
- Object.keys(packageImport.devDependencies || {}),
38
- );
39
- return { packageNames };
40
- }
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
-
82
- /** @type { import("@cspell/cspell-types").CSpellUserSettings } */
83
- const config = {
84
- language: "en-GB",
85
- words: [
86
- ...[
87
- ...determinePackageNamesAndMethods().packageNames,
88
- ...determineComposerPackageNamesAndMethods().packageNames,
89
- "commitlint",
90
- "sass",
91
- "Userback",
92
- "phpcs",
93
- "phpcbf",
94
- ], // package and language names
95
- ...["tsbuildinfo", "svgs"], // filenames
96
- ...["combobox", "spinbutton"], // accessible roles
97
- ...["popover", "dialog"], // custom element names
98
- ...["atomicsmash"], // company all lowercase
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
- "phpmailer",
109
- "WPMDB", // WP Migrate DB
110
- "shortcode",
111
- "wp_kses",
112
- "sprintf", // For @wordpress/i18n
113
- ], // WordPress stuff
114
- ],
115
- languageSettings: [
116
- {
117
- languageId: "*",
118
- locale: "en-GB",
119
- },
120
- {
121
- languageId: "css, less, scss, sass",
122
- locale: "en-US",
123
- dictionaries: ["css"],
124
- },
125
- {
126
- languageId: "javascript,typescript,javascriptreact,typescriptreact",
127
- locale: "en-GB",
128
- dictionaries: ["typescript"],
129
- },
130
- {
131
- languageId: "php",
132
- locale: "en-GB",
133
- dictionaries: ["php", "html"],
134
- },
135
- {
136
- languageId: "html,vue-html,javascriptreact,typescriptreact",
137
- locale: "en-GB",
138
- dictionaries: ["html"],
139
- },
140
- ],
141
- };
142
- module.exports = config;
1
+ module.exports = require("./index.cjs");
@@ -0,0 +1,142 @@
1
+ import { existsSync, readFileSync } from "fs";
2
+ import { resolve, dirname, join } from "path";
3
+
4
+ /**
5
+ * Search for `package.json`
6
+ * @param {string} from - search `from` directory.
7
+ * @returns {string|void} - path to package.json
8
+ */
9
+ function findNearestPackageJson(from) {
10
+ from = resolve(from);
11
+ const parent = dirname(from);
12
+ if (!from || parent === from) {
13
+ return;
14
+ }
15
+
16
+ const pkg = join(from, "package.json");
17
+ if (existsSync(pkg)) {
18
+ return pkg;
19
+ }
20
+ return findNearestPackageJson(parent);
21
+ }
22
+
23
+ /**
24
+ * Load the nearest package.json
25
+ * @param {string} cwd
26
+ * @returns
27
+ */
28
+ function loadPackageJson(cwd) {
29
+ const pkgFile = findNearestPackageJson(cwd);
30
+ if (!pkgFile) return;
31
+ return JSON.parse(readFileSync(pkgFile, "utf-8"));
32
+ }
33
+
34
+ function determinePackageNamesAndMethods(cwd = process.cwd()) {
35
+ const packageImport = loadPackageJson(cwd) || {};
36
+ const packageNames = Object.keys(packageImport.dependencies || {}).concat(
37
+ Object.keys(packageImport.devDependencies || {}),
38
+ );
39
+ return { packageNames };
40
+ }
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 = resolve(from);
49
+ const parent = dirname(from);
50
+ if (!from || parent === from) {
51
+ return;
52
+ }
53
+
54
+ const composerJsonPath = join(from, "composer.json");
55
+ if (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(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
+
82
+ /** @type { import("@cspell/cspell-types").CSpellUserSettings } */
83
+ const config = {
84
+ language: "en-GB",
85
+ words: [
86
+ ...[
87
+ ...determinePackageNamesAndMethods().packageNames,
88
+ ...determineComposerPackageNamesAndMethods().packageNames,
89
+ "commitlint",
90
+ "sass",
91
+ "Userback",
92
+ "phpcs",
93
+ "phpcbf",
94
+ ], // package and language names
95
+ ...["tsbuildinfo", "svgs"], // filenames
96
+ ...["combobox", "spinbutton"], // accessible roles
97
+ ...["popover", "dialog"], // custom element names
98
+ ...["atomicsmash"], // company all lowercase
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
+ "phpmailer",
109
+ "WPMDB", // WP Migrate DB
110
+ "shortcode",
111
+ "wp_kses",
112
+ "sprintf", // For @wordpress/i18n
113
+ ], // WordPress stuff
114
+ ],
115
+ languageSettings: [
116
+ {
117
+ languageId: "*",
118
+ locale: "en-GB",
119
+ },
120
+ {
121
+ languageId: "css, less, scss, sass",
122
+ locale: "en-US",
123
+ dictionaries: ["css"],
124
+ },
125
+ {
126
+ languageId: "javascript,typescript,javascriptreact,typescriptreact",
127
+ locale: "en-GB",
128
+ dictionaries: ["typescript"],
129
+ },
130
+ {
131
+ languageId: "php",
132
+ locale: "en-GB",
133
+ dictionaries: ["php", "html"],
134
+ },
135
+ {
136
+ languageId: "html,vue-html,javascriptreact,typescriptreact",
137
+ locale: "en-GB",
138
+ dictionaries: ["html"],
139
+ },
140
+ ],
141
+ };
142
+ export default config;
package/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  module.exports = {
2
2
  commitlintConfig: require("./commitlint"),
3
- cspellConfig: require("./cspell"),
4
- prettierConfig: require("./prettier"),
3
+ cspellConfig: require("./cspell/index.cjs"),
4
+ prettierConfig: require("./prettier/index.cjs"),
5
+ stylelintConfig: require("./stylelint/index.cjs"),
5
6
  };
package/index.mjs ADDED
@@ -0,0 +1,4 @@
1
+ import { default as cspellConfig } from "./cspell/index.mjs";
2
+ import { default as prettierConfig } from "./prettier/index.mjs";
3
+ import { default as stylelintConfig } from "./stylelint/index.mjs";
4
+ export { cspellConfig, prettierConfig, stylelintConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomicsmash/coding-standards",
3
- "version": "13.0.0-beta.2",
3
+ "version": "13.0.0-beta.4",
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.15.4"
9
9
  },
10
10
  "peerDependencies": {
11
- "@atomicsmash/browserslist-config": "^13.0.0-beta.2",
12
- "@atomicsmash/eslint-config": "^13.0.0-beta.2",
11
+ "@atomicsmash/browserslist-config": "^13.0.0-beta.4",
12
+ "@atomicsmash/eslint-config": "^13.0.0-beta.4",
13
13
  "@commitlint/cli": "^19.5.0",
14
14
  "@commitlint/config-conventional": "^19.5.0",
15
15
  "@wordpress/stylelint-config": "^23.2.0",
@@ -0,0 +1,35 @@
1
+ module.exports = {
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
+
19
+ // Tabs are better for visually impaired coders https://www.reddit.com/r/javascript/comments/c8drjo/nobody_talks_about_the_real_reason_to_use_tabs/
20
+ useTabs: true,
21
+
22
+ // Helps clean up git diffs by removing changes of a single comma on a line if adding a new line to the bottom
23
+ trailingComma: "all",
24
+
25
+ overrides: [
26
+ {
27
+ // yml files require specific indentation rules
28
+ files: ["*.yml", "*.yaml"],
29
+ options: {
30
+ useTabs: false,
31
+ tabWidth: 2,
32
+ },
33
+ },
34
+ ],
35
+ };
package/prettier/index.js CHANGED
@@ -1,35 +1 @@
1
- module.exports = {
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
-
19
- // Tabs are better for visually impaired coders https://www.reddit.com/r/javascript/comments/c8drjo/nobody_talks_about_the_real_reason_to_use_tabs/
20
- useTabs: true,
21
-
22
- // Helps clean up git diffs by removing changes of a single comma on a line if adding a new line to the bottom
23
- trailingComma: "all",
24
-
25
- overrides: [
26
- {
27
- // yml files require specific indentation rules
28
- files: ["*.yml", "*.yaml"],
29
- options: {
30
- useTabs: false,
31
- tabWidth: 2,
32
- },
33
- },
34
- ],
35
- };
1
+ module.exports = require("./index.cjs");