Skip to content

Commit c52cba4

Browse files
committed
Update for d.js v12, new lint rules
1 parent 57d37e4 commit c52cba4

File tree

91 files changed

+969
-765
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+969
-765
lines changed

.github/workflows/build_indev_docs.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313
- name: Checkout repository
1414
uses: actions/checkout@v1
1515

16-
- name: Install Node v10
16+
- name: Install Node v14
1717
uses: actions/setup-node@v1
1818
with:
19-
node-version: 10
19+
node-version: 14
2020

2121
- name: Install dependencies
2222
run: |
@@ -25,13 +25,18 @@ jobs:
2525
- name: Clone gh-pages branch
2626
run: git clone https://${{ github.actor }}:${{ secrets.DOCS_TOKEN }}@github.com/${{ github.repository }}.git -b gh-pages ../yamdbf-docs
2727

28-
- name: Build docs
28+
- name: Build project and run localization doc generation script
2929
run: |
3030
npm run build
31-
npm run docs:indev
31+
npm run localization
3232
33-
- name: Build localization string list
34-
run: npm run localization
33+
- name: Switch to node v8.9.3
34+
uses: actions/setup-node@v1
35+
with:
36+
node-version: 8.9.3
37+
38+
- name: Build docs
39+
npm run docs:indev
3540

3641
- name: Check if commit is needed
3742
id: git_status

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ npm-debug*
88
/test/**/*.js*
99
test_*.js
1010
/scripts/**/*.js
11+
/scripts/**/*.js.map
1112
/scripts/**/*.d.ts
1213
/scripts/storage
1314
*.sqlite

gulpfile.js

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,35 @@
1+
/* eslint-disable @typescript-eslint/typedef, no-return-assign, @typescript-eslint/explicit-function-return-type */
12
const gulp = require('gulp');
2-
const gulp_ts = require('gulp-typescript');
3-
const gulp_sourcemaps = require('gulp-sourcemaps');
3+
const typescript = require('gulp-typescript');
4+
const sourcemaps = require('gulp-sourcemaps');
5+
const eslint = require('gulp-eslint');
46
const del = require('del');
57
const path = require('path');
68
const { execSync } = require('child_process');
79

8-
const project = gulp_ts.createProject('tsconfig.json');
10+
const project = typescript.createProject('tsconfig.json');
911

10-
let _linter;
11-
let _gulp_tslint;
12-
let _tslint;
1312
let _runSequence;
1413

1514
const runSequence = () => _runSequence = _runSequence || require('run-sequence');
16-
const gulp_tslint = () => _gulp_tslint = _gulp_tslint || require('gulp-tslint');
17-
const tslint = () => _tslint = _tslint || require('tslint');
18-
const linter = () => _linter = _linter || tslint().Linter.createProgram('tsconfig.json');
1915

20-
gulp.task('default', ['build']);
21-
gulp.task('build:vscode', cb => runSequence()('lint', 'build', cb));
2216
gulp.task('build:docs', () => execSync('npm run docs:indev'));
2317
gulp.task('docs', cb => runSequence()('build', 'build:docs', cb));
2418
gulp.task('gh-prebuild', cb => runSequence()('build', 'gh-prebuild-prepare', cb));
2519

2620
gulp.task('pause', cb => setTimeout(() => cb(), 1e3));
27-
gulp.task('tests', cb => runSequence()('lint', 'build', 'pause', 'build:tests', cb));
2821

29-
gulp.task('lint', () => {
22+
gulp.task('lint', () =>
3023
gulp.src('src/**/*.ts')
31-
.pipe(gulp_tslint()({
32-
configuration: 'tslint.json',
33-
formatter: 'prose',
34-
program: linter()
35-
}))
36-
.pipe(gulp_tslint().report());
37-
})
38-
39-
gulp.task('build', () => {
24+
.pipe(eslint())
25+
.pipe(eslint.format())
26+
.pipe(eslint.failAfterError()));
27+
28+
gulp.task('build', () =>
29+
{
4030
del.sync(['bin/**/*.*']);
4131
const tsCompile = gulp.src('src/**/*.ts')
42-
.pipe(gulp_sourcemaps.init({ base: 'src' }))
32+
.pipe(sourcemaps.init({ base: 'src' }))
4333
.pipe(project());
4434

4535
tsCompile.pipe(gulp.dest('bin/'));
@@ -49,11 +39,12 @@ gulp.task('build', () => {
4939
gulp.src('src/**/*.lang').pipe(gulp.dest('bin/'));
5040

5141
return tsCompile.js
52-
.pipe(gulp_sourcemaps.write('.', { sourceRoot: '../src' }))
42+
.pipe(sourcemaps.write('.', { sourceRoot: '../src' }))
5343
.pipe(gulp.dest('bin/'));
5444
});
5545

56-
gulp.task('gh-prebuild-prepare', () => {
46+
gulp.task('gh-prebuild-prepare', () =>
47+
{
5748
del.sync([
5849
'../yamdbf-prebuilt/**',
5950
'../yamdbf-prebuilt/.*',
@@ -63,25 +54,39 @@ gulp.task('gh-prebuild-prepare', () => {
6354
], { force: true });
6455
gulp.src('bin/**/*.*').pipe(gulp.dest('../yamdbf-prebuilt/bin'));
6556
gulp.src('package.json').pipe(gulp.dest('../yamdbf-prebuilt'));
66-
})
57+
});
6758

68-
gulp.task('build:tests', () => {
59+
gulp.task('build:tests', () =>
60+
{
6961
del.sync(['test/**/*.js']);
7062
const tsCompile = gulp.src('test/**/*.ts')
71-
.pipe(gulp_sourcemaps.init({ base: 'test' }))
63+
.pipe(sourcemaps.init({ base: 'test' }))
7264
.pipe(project());
7365

7466
tsCompile.pipe(gulp.dest('test/'));
7567

7668
return tsCompile.js
77-
.pipe(gulp_sourcemaps.mapSources(sourcePath => path.join(__dirname, 'test', sourcePath)))
78-
.pipe(gulp_sourcemaps.write())
69+
.pipe(sourcemaps.mapSources(sourcePath => path.join(__dirname, 'test', sourcePath)))
70+
.pipe(sourcemaps.write())
7971
.pipe(gulp.dest('test/'));
8072
});
8173

82-
gulp.task('build:scripts', () => {
74+
gulp.task('build:scripts', () =>
75+
{
8376
del.sync(['scripts/**/*.js']);
84-
gulp.src('scripts/**/*.ts')
85-
.pipe(project())
77+
del.sync(['scripts/**/*.js.map']);
78+
del.sync(['scripts/**/*.d.ts']);
79+
const tsCompile = gulp.src('scripts/**/*.ts')
80+
.pipe(sourcemaps.init({ base: 'scripts' }))
81+
.pipe(project());
82+
83+
tsCompile.pipe(gulp.dest('scripts/'));
84+
85+
return tsCompile.js
86+
.pipe(sourcemaps.write('.', { sourceRoot: '../scripts' }))
8687
.pipe(gulp.dest('scripts/'));
8788
});
89+
90+
gulp.task('default', gulp.series('build'));
91+
gulp.task('build:vscode', gulp.series('lint', 'build'));
92+
gulp.task('tests', gulp.series('lint', 'build', 'pause', 'build:tests'));

package.json

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,29 +49,35 @@
4949
"pg": "7.10.0",
5050
"sequelize": "5.7.6",
5151
"sequelize-typescript": "1.0.0-alpha.9",
52-
"sqlite3": "4.0.6",
52+
"sqlite3": "^5.0.0",
5353
"tedious": "6.1.1"
5454
},
5555
"devDependencies": {
56+
"@discord-samba/eslint-config": "github:discord-samba/eslint-config",
5657
"@types/chalk": "^0.4.31",
5758
"@types/glob": "^5.0.30",
5859
"@types/node": "^8.0.19",
5960
"@types/node-json-db": "0.0.1",
6061
"@types/sequelize": "^4.0.68",
62+
"@typescript-eslint/eslint-plugin": "^2.4.0",
63+
"@typescript-eslint/parser": "^2.4.0",
6164
"cross-env": "^5.1.3",
62-
"del": "^3.0.0",
63-
"gulp": "^3.9.1",
64-
"gulp-sourcemaps": "^2.4.1",
65-
"gulp-tslint": "^8.1.1",
66-
"gulp-typescript": "^4.0.2",
65+
"del": "^6.0.0",
66+
"eslint": "^6.5.1",
67+
"gulp": "^4.0.2",
68+
"gulp-eslint": "^6.0.0",
69+
"gulp-sourcemaps": "^3.0.0",
70+
"gulp-typescript": "^5.0.1",
6771
"jsdoc": "zajrik/jsdoc",
6872
"jsdoc-strip-async-await": "^0.1.0",
6973
"minami": "zajrik/minami",
7074
"run-sequence": "^1.2.2",
7175
"sequelize": "^5.7.6",
72-
"sqlite3": "^4.0.6",
7376
"ts-node": "^6.1.1",
74-
"tslint": "^5.4.3",
75-
"typescript": "^3.7.0-beta"
77+
"typescript": "^3.7.2"
78+
},
79+
"eslintConfig": {
80+
"extends": "@discord-samba",
81+
"ignorePatterns": "test/*"
7682
}
7783
}

scripts/generateBaseCommandNameFiles.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export type BaseCommandName = ${commands.map(c => `'${c}'`).join('\n\t| ')};
3636
}
3737
}
3838
logger.log('Script', 'Starting base command names file builder');
39+
// @ts-ignore Needed to run the script
3940
const script: ScriptClient = new ScriptClient();
4041

4142
process.on('unhandledRejection', (err: any) => logger.error(err));

scripts/generateDefaultLocalizationMarkdown.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class ScriptClient extends Client
7171
}
7272
}
7373
logger.log('Script', 'Starting localization markdown builder');
74+
// @ts-ignore Needed to run the script
7475
const script: ScriptClient = new ScriptClient();
7576

7677
process.on('unhandledRejection', (err: any) => logger.error(err));

scripts/generateLocalizationStringsEnum.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export enum BaseStrings
3232
}
3333
}
3434
logger.log('Script', 'Starting base string key enum file builder');
35+
// @ts-ignore Needed to run the script
3536
const script: ScriptClient = new ScriptClient();
3637

3738
process.on('unhandledRejection', (err: any) => logger.error(err));

0 commit comments

Comments
 (0)