Skip to content

Commit d84b3e0

Browse files
committed
Remove .eslintignore and .prettierignore
1 parent 46b4184 commit d84b3e0

File tree

3 files changed

+23
-18
lines changed

3 files changed

+23
-18
lines changed

.eslintignore

Lines changed: 0 additions & 6 deletions
This file was deleted.

.prettierignore

Lines changed: 0 additions & 6 deletions
This file was deleted.

npm-scripts.mjs

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,28 @@
11
import * as process from 'node:process';
22
import * as path from 'node:path';
3-
import * as os from 'node:os';
43
import * as fs from 'node:fs';
54
import { execSync } from 'node:child_process';
65

76
const PKG = JSON.parse(fs.readFileSync('./package.json').toString());
8-
const IS_WINDOWS = os.platform() === 'win32';
97
const MAYOR_VERSION = PKG.version.split('.')[0];
108

9+
// Paths for ESLint to check. Converted to string for convenience.
10+
const ESLINT_PATHS = ['src', 'npm-scripts.mjs'].join(' ');
11+
// Paths for ESLint to ignore. Converted to string argument for convenience.
12+
const ESLINT_IGNORE_PATTERN_ARGS = []
13+
.map(entry => `--ignore-pattern ${entry}`)
14+
.join(' ');
15+
// Paths for Prettier to check/write. Converted to string for convenience.
16+
// NOTE: Prettier ignores paths in .gitignore so we don't need to care about
17+
// node/src/fbs.
18+
const PRETTIER_PATHS = [
19+
'README.md',
20+
'src',
21+
'npm-scripts.mjs',
22+
'package.json',
23+
'tsconfig.json',
24+
].join(' ');
25+
1126
const task = process.argv[2];
1227
const args = process.argv.slice(3).join(' ');
1328

@@ -148,19 +163,21 @@ function buildTypescript({ force = false } = { force: false }) {
148163
function lint() {
149164
logInfo('lint()');
150165

151-
executeCmd('prettier . --check');
152-
153166
// Ensure there are no rules that are unnecessary or conflict with Prettier
154167
// rules.
155168
executeCmd('eslint-config-prettier .eslintrc.js');
156169

157-
executeCmd('eslint -c .eslintrc.js --max-warnings 0 .');
170+
executeCmd(
171+
`eslint -c .eslintrc.js --ext=ts,js,mjs --max-warnings 0 ${ESLINT_IGNORE_PATTERN_ARGS} ${ESLINT_PATHS}`
172+
);
173+
174+
executeCmd(`prettier --check ${PRETTIER_PATHS}`);
158175
}
159176

160177
function format() {
161178
logInfo('format()');
162179

163-
executeCmd('prettier . --write');
180+
executeCmd(`prettier --write ${PRETTIER_PATHS}`);
164181
}
165182

166183
function test() {

0 commit comments

Comments
 (0)