eslint-config-dolmios 1.3.0 → 1.3.2
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/.prettierrc.json +1 -1
- package/LICENSE.md +1 -0
- package/README.md +20 -14
- package/index.js +1 -5
- package/package.json +13 -19
- package/.pinyarn.js +0 -152
- package/.yarnrc.yml +0 -3
package/.prettierrc.json
CHANGED
package/LICENSE.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
It's an ESLINT config, go crazy.
|
package/README.md
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
# eslint-config-dolmios
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> A simple ESLint setup using [@typescript-eslint](https://typescript-eslint.io).
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Ensure that you have `eslint`installed. Then install the package:
|
|
5
|
+
## Install
|
|
8
6
|
|
|
9
7
|
```bash
|
|
10
|
-
|
|
8
|
+
npm install eslint-config-dolmios
|
|
11
9
|
```
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
````
|
|
16
|
-
|
|
17
|
-
### Usage
|
|
11
|
+
## Usage
|
|
18
12
|
|
|
19
13
|
Populate `.eslintrc` with the following, and code away.
|
|
20
14
|
|
|
@@ -22,13 +16,25 @@ Populate `.eslintrc` with the following, and code away.
|
|
|
22
16
|
{
|
|
23
17
|
"extends": ["dolmios"]
|
|
24
18
|
}
|
|
25
|
-
|
|
19
|
+
```
|
|
26
20
|
|
|
27
|
-
|
|
21
|
+
#### Usage with Prettier
|
|
28
22
|
|
|
29
|
-
Prettier is configured to work nicely with this config, though is an optional inclusion. If you'd like to include the config, you can add it
|
|
30
|
-
to `package.json`.
|
|
23
|
+
Prettier is configured to work nicely with this config, though is an optional inclusion. If you'd like to include the config, you can add it to `package.json`.
|
|
31
24
|
|
|
32
25
|
```json
|
|
33
26
|
"prettier": "eslint-config-dolmios/.prettierrc.json"
|
|
34
27
|
```
|
|
28
|
+
|
|
29
|
+
## Contributing
|
|
30
|
+
|
|
31
|
+
Feel free to get in touch with feedback, advice or suggestions. See [Conventional Commits](https://gist.github.com/dolmios/0e33c579a500d87fc6f44df6cde97259) for new contributors.
|
|
32
|
+
|
|
33
|
+
## Acknowledgments
|
|
34
|
+
|
|
35
|
+
- [eslint-plugin-sort-keys-fix](https://github.com/leo-buneev/eslint-plugin-sort-keys-fix)
|
|
36
|
+
- [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import)
|
|
37
|
+
|
|
38
|
+
## License
|
|
39
|
+
|
|
40
|
+
It's an ESLINT config, go crazy.
|
package/index.js
CHANGED
|
@@ -4,11 +4,7 @@ module.exports = {
|
|
|
4
4
|
es6: true,
|
|
5
5
|
node: true,
|
|
6
6
|
},
|
|
7
|
-
extends: [
|
|
8
|
-
'plugin:@typescript-eslint/recommended',
|
|
9
|
-
'plugin:import/recommended',
|
|
10
|
-
'eslint:recommended',
|
|
11
|
-
],
|
|
7
|
+
extends: ['plugin:@typescript-eslint/recommended', 'plugin:import/recommended', 'eslint:recommended'],
|
|
12
8
|
parser: '@typescript-eslint/parser',
|
|
13
9
|
plugins: ['sort-keys-fix', '@typescript-eslint'],
|
|
14
10
|
root: true,
|
package/package.json
CHANGED
|
@@ -1,36 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-dolmios",
|
|
3
|
-
"description": "
|
|
4
|
-
"version": "1.3.
|
|
3
|
+
"description": " A simple ESLint setup using @typescript-eslint",
|
|
4
|
+
"version": "1.3.2",
|
|
5
5
|
"author": "Jackson Dolman <mail@dolmios.com>",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/dolmios/eslint-config-dolmios/issues"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
11
|
-
"@typescript-eslint/parser": "^5.
|
|
12
|
-
"eslint": "^8.
|
|
10
|
+
"@typescript-eslint/eslint-plugin": "^5.46.1",
|
|
11
|
+
"@typescript-eslint/parser": "^5.46.1",
|
|
12
|
+
"eslint": "^8.29.0",
|
|
13
13
|
"eslint-plugin-import": "^2.26.0",
|
|
14
14
|
"eslint-plugin-sort-keys-fix": "^1.1.2",
|
|
15
|
-
"prettier": "^2.
|
|
16
|
-
"typescript": "^4.
|
|
15
|
+
"prettier": "^2.8.1",
|
|
16
|
+
"typescript": "^4.9.4"
|
|
17
17
|
},
|
|
18
18
|
"homepage": "https://github.com/dolmios/eslint-config-dolmios#readme",
|
|
19
19
|
"keywords": [
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"es6",
|
|
25
|
-
"jsx",
|
|
26
|
-
"lint",
|
|
27
|
-
"next",
|
|
28
|
-
"react",
|
|
29
|
-
"style guide"
|
|
20
|
+
"eslint",
|
|
21
|
+
"eslintconfig",
|
|
22
|
+
"linting",
|
|
23
|
+
"typescript"
|
|
30
24
|
],
|
|
31
25
|
"license": "MIT",
|
|
32
26
|
"main": "index.js",
|
|
33
|
-
"packageManager": "yarn@3.
|
|
27
|
+
"packageManager": "yarn@3.3.0",
|
|
34
28
|
"repository": {
|
|
35
29
|
"type": "git",
|
|
36
30
|
"url": "git+https://github.com/dolmios/eslint-config-dolmios.git"
|
|
@@ -38,4 +32,4 @@
|
|
|
38
32
|
"scripts": {
|
|
39
33
|
"test": "eslint --ext .js"
|
|
40
34
|
}
|
|
41
|
-
}
|
|
35
|
+
}
|
package/.pinyarn.js
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
// To update this file use `yarn dlx pinyarn <yarn_version>` or `npx pinyarn <yarn_version>`
|
|
2
|
-
const https = require('https');
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const crypto = require('crypto');
|
|
5
|
-
const path = require('path');
|
|
6
|
-
const zlib = require('zlib');
|
|
7
|
-
const { PassThrough } = require('stream');
|
|
8
|
-
|
|
9
|
-
const config = {
|
|
10
|
-
"ghTokens": [
|
|
11
|
-
[
|
|
12
|
-
"ghp_H",
|
|
13
|
-
"bcraD8d0OUWoxJdIlgNLNXpyhzS7n1HutiA"
|
|
14
|
-
],
|
|
15
|
-
[
|
|
16
|
-
"ghp_9",
|
|
17
|
-
"HV9r3y93wz0unBeT1SyeILnFZxUzz3dBdrA"
|
|
18
|
-
],
|
|
19
|
-
[
|
|
20
|
-
"ghp_r",
|
|
21
|
-
"7dvv4UhJhdhbXSKkcGnjCNtUBFznY1vDhx4"
|
|
22
|
-
]
|
|
23
|
-
],
|
|
24
|
-
"yarnUrl": "https://raw.githubusercontent.com/yarnpkg/berry/%40yarnpkg/cli/3.2.4/packages/yarnpkg-cli/bin/yarn.js"
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const getUrlHash = url => crypto.createHash('sha256').update(url).digest('hex').substring(0, 8);
|
|
28
|
-
|
|
29
|
-
const YARN_URL_HASH = getUrlHash(config.yarnUrl);
|
|
30
|
-
let BERRY_HEADERS = {
|
|
31
|
-
'User-Agent': `pinyarn/?`
|
|
32
|
-
};
|
|
33
|
-
if (config.yarnUrl.includes('/artifacts/')) {
|
|
34
|
-
BERRY_HEADERS['Authorization'] = `token ${config.ghTokens[Math.floor(Math.random() * config.ghTokens.length)].join('')}`;
|
|
35
|
-
}
|
|
36
|
-
const YARNRC_YML_PATH = path.join(__dirname, '.yarnrc.yml');
|
|
37
|
-
const PLUGIN_LIST = !fs.existsSync(YARNRC_YML_PATH) ? [] : fs.readFileSync(YARNRC_YML_PATH, 'utf-8')
|
|
38
|
-
.split('\n')
|
|
39
|
-
.filter(line => line.includes('.yarn/plugins/@yarnpkg/plugin-'))
|
|
40
|
-
.map(line => line.replace(/^.*\.yarn\/plugins\/@yarnpkg\/plugin-(.*?)(?:-[0-9a-f]{8})?\.cjs$/, '$1'));
|
|
41
|
-
const YARN_DIR = path.join(__dirname, '.yarn');
|
|
42
|
-
const RELEASES_DIR = path.join(YARN_DIR, 'releases');
|
|
43
|
-
const PLUGIN_DIR = path.join(YARN_DIR, 'plugins');
|
|
44
|
-
const YARN_BINARY = path.join(RELEASES_DIR, `yarn-${YARN_URL_HASH}.cjs`);
|
|
45
|
-
|
|
46
|
-
let stats;
|
|
47
|
-
try {
|
|
48
|
-
stats = fs.statSync(RELEASES_DIR);
|
|
49
|
-
} catch (e) {}
|
|
50
|
-
const CURRENT_YARN_BINARYNAME = !stats ? null : fs.readdirSync(RELEASES_DIR)[0];
|
|
51
|
-
const CURRENT_YARN_URL_HASH = !CURRENT_YARN_BINARYNAME ? null : path.basename(CURRENT_YARN_BINARYNAME).slice(0, -path.extname(CURRENT_YARN_BINARYNAME).length).replace('yarn-', '');
|
|
52
|
-
|
|
53
|
-
const downloadFile = (filePath, url) => {
|
|
54
|
-
const urlParts = new URL(url);
|
|
55
|
-
return new Promise((resolve, reject) =>
|
|
56
|
-
https.get({
|
|
57
|
-
host: urlParts.host,
|
|
58
|
-
path: urlParts.pathname + urlParts.search,
|
|
59
|
-
headers: BERRY_HEADERS
|
|
60
|
-
}, res => {
|
|
61
|
-
if (res.statusCode === 301 || res.statusCode === 302) {
|
|
62
|
-
downloadFile(filePath, res.headers.location).then(resolve, reject);
|
|
63
|
-
} else if (res.statusCode !== 200) {
|
|
64
|
-
throw new Error(`Error downloading ${url}, status: ${res.statusCode}`);
|
|
65
|
-
} else {
|
|
66
|
-
const isZip = res.headers["content-type"] === 'application/zip';
|
|
67
|
-
if (isZip) {
|
|
68
|
-
const bufs = []
|
|
69
|
-
res
|
|
70
|
-
.on('data', chunk => {
|
|
71
|
-
bufs.push(chunk);
|
|
72
|
-
})
|
|
73
|
-
.on('error', err => {
|
|
74
|
-
reject(err);
|
|
75
|
-
})
|
|
76
|
-
.on('end', () => {
|
|
77
|
-
const buf = Buffer.concat(bufs);
|
|
78
|
-
const name = 'yarnpkg-cli/bundles/yarn-min.js';
|
|
79
|
-
const locOff = buf.indexOf(name);
|
|
80
|
-
const off = buf.indexOf(name, locOff + 1);
|
|
81
|
-
const dataSize = buf.readUInt32LE(off - 26);
|
|
82
|
-
const dataStart = locOff + name.length;
|
|
83
|
-
const data = buf.slice(dataStart, dataStart + dataSize);
|
|
84
|
-
fs.writeFileSync(filePath, zlib.inflateRawSync(data));
|
|
85
|
-
resolve();
|
|
86
|
-
});
|
|
87
|
-
} else {
|
|
88
|
-
const file = fs.createWriteStream(filePath);
|
|
89
|
-
res
|
|
90
|
-
.on('data', chunk => {
|
|
91
|
-
file.write(chunk);
|
|
92
|
-
})
|
|
93
|
-
.on('error', err => {
|
|
94
|
-
reject(err);
|
|
95
|
-
})
|
|
96
|
-
.on('end', () => file.end());
|
|
97
|
-
file
|
|
98
|
-
.on('finish', resolve);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}).on('error', reject)
|
|
102
|
-
).catch(err => {
|
|
103
|
-
fs.unlinkSync(filePath);
|
|
104
|
-
throw err;
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const promises = []
|
|
109
|
-
|
|
110
|
-
if (CURRENT_YARN_URL_HASH !== YARN_URL_HASH) {
|
|
111
|
-
if (CURRENT_YARN_BINARYNAME) {
|
|
112
|
-
if (fs.existsSync(RELEASES_DIR))
|
|
113
|
-
fs.rmdirSync(RELEASES_DIR, { recursive: true });
|
|
114
|
-
if (fs.existsSync(PLUGIN_DIR))
|
|
115
|
-
fs.rmdirSync(PLUGIN_DIR, { recursive: true });
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if (!fs.existsSync(RELEASES_DIR))
|
|
119
|
-
fs.mkdirSync(RELEASES_DIR, { recursive: true });
|
|
120
|
-
|
|
121
|
-
promises.push(downloadFile(YARN_BINARY, config.yarnUrl));
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
for (const plugin of PLUGIN_LIST) {
|
|
125
|
-
const pluginUrl = (config.pluginUrls || {})[plugin];
|
|
126
|
-
if (pluginUrl) {
|
|
127
|
-
const pluginPath = path.join(PLUGIN_DIR, '@yarnpkg', `plugin-${plugin}-${getUrlHash(pluginUrl)}.cjs`)
|
|
128
|
-
if (!fs.existsSync(pluginPath)) {
|
|
129
|
-
fs.mkdirSync(path.join(PLUGIN_DIR, '@yarnpkg'), { recursive: true });
|
|
130
|
-
promises.push(downloadFile(pluginPath, pluginUrl));
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
if (PLUGIN_LIST.length === 0) {
|
|
136
|
-
if (fs.existsSync(PLUGIN_DIR))
|
|
137
|
-
fs.rmdirSync(PLUGIN_DIR, { recursive: true });
|
|
138
|
-
} else {
|
|
139
|
-
const entries = fs.readdirSync(path.join(PLUGIN_DIR, '@yarnpkg'));
|
|
140
|
-
for (const entry of entries) {
|
|
141
|
-
const [,plugin, pluginHash] = entry.match(/plugin-(.*?)(?:-)?([0-9a-f]{8})?\.cjs/);
|
|
142
|
-
const pluginUrl = (config.pluginUrls || {})[plugin];
|
|
143
|
-
if (pluginUrl && (!PLUGIN_LIST.includes(plugin) || getUrlHash(pluginUrl) !== pluginHash))
|
|
144
|
-
fs.unlinkSync(path.join(PLUGIN_DIR, '@yarnpkg', entry));
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
Promise.all(promises)
|
|
149
|
-
.then(
|
|
150
|
-
() => require(YARN_BINARY),
|
|
151
|
-
console.error
|
|
152
|
-
);
|
package/.yarnrc.yml
DELETED