Skip to content

Commit

Permalink
Merge branch 'master' into ts-in-js
Browse files Browse the repository at this point in the history
  • Loading branch information
Orta authored Sep 11, 2019
2 parents 2769755 + fb9b3fe commit 2c967c4
Show file tree
Hide file tree
Showing 626 changed files with 42,446 additions and 9,321 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/built/local/**
/tests/**
/lib/**
/src/lib/*.generated.d.ts
110 changes: 110 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"warnOnUnsupportedTypeScriptVersion": false,
"ecmaVersion": 6,
"sourceType": "module"
},
"env": {
"browser": false,
"node": true,
"es6": true
},
"plugins": [
"@typescript-eslint", "jsdoc", "no-null", "import"
],
"rules": {
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/array-type": "error",

"camelcase": "off",
"@typescript-eslint/camelcase": ["error", { "properties": "never", "allow": ["^[A-Za-z][a-zA-Za-z]+_[A-Za-z]+$"] }],

"@typescript-eslint/class-name-casing": "error",
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
"@typescript-eslint/interface-name-prefix": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-this-alias": "error",
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/prefer-namespace-keyword": "error",

"quotes": "off",
"@typescript-eslint/quotes": ["error", "double", { "avoidEscape": true, "allowTemplateLiterals": true }],

"semi": "off",
"@typescript-eslint/semi": "error",

"@typescript-eslint/triple-slash-reference": "error",
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unified-signatures": "error",

// scripts/eslint/rules
"object-literal-surrounding-space": "error",
"no-type-assertion-whitespace": "error",
"type-operator-spacing": "error",
"only-arrow-functions": ["error", {
"allowNamedFunctions": true ,
"allowDeclarations": true
}],
"no-double-space": "error",
"boolean-trivia": "error",
"no-in-operator": "error",
"simple-indent": "error",
"debug-assert": "error",
"no-keywords": "error",

// eslint-plugin-import
"import/no-extraneous-dependencies": ["error", { "optionalDependencies": false }],

// eslint-plugin-no-null
"no-null/no-null": "error",

// eslint-plugin-jsdoc
"jsdoc/check-alignment": "error",

// eslint
"brace-style": ["error", "stroustrup", { "allowSingleLine": true }],
"constructor-super": "error",
"curly": ["error", "multi-line"],
"dot-notation": "error",
"eqeqeq": "error",
"linebreak-style": ["error", "windows"],
"new-parens": "error",
"no-caller": "error",
"no-duplicate-case": "error",
"no-duplicate-imports": "error",
"no-empty": "error",
"no-eval": "error",
"no-extra-bind": "error",
"no-fallthrough": "error",
"no-new-func": "error",
"no-new-wrappers": "error",
"no-return-await": "error",
"no-restricted-globals": ["error",
{ "name": "setTimeout" },
{ "name": "clearTimeout" },
{ "name": "setInterval" },
{ "name": "clearInterval" },
{ "name": "setImmediate" },
{ "name": "clearImmediate" }
],
"no-sparse-arrays": "error",
"no-template-curly-in-string": "error",
"no-throw-literal": "error",
"no-trailing-spaces": "error",
"no-undef-init": "error",
"no-unsafe-finally": "error",
"no-unused-expressions": ["error", { "allowTernary": true }],
"no-unused-labels": "error",
"no-var": "error",
"object-shorthand": "error",
"prefer-const": "error",
"prefer-object-spread": "error",
"quote-props": ["error", "consistent-as-needed"],
"space-in-parens": "error",
"unicode-bom": ["error", "never"],
"use-isnan": "error"
}
}
6 changes: 5 additions & 1 deletion .github/ISSUE_TEMPLATE/Feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ about: Suggest an idea for this project

<!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨
Half of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Please read the FAQ first, especially the "Common Feature Requests" section.
Half of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker.
Please help us by doing the following steps before logging an issue:
* Search: https://github.com/Microsoft/TypeScript/search?type=Issues
* Read the FAQ, especially the "Common Feature Requests" section: https://github.com/Microsoft/TypeScript/wiki/FAQ
-->

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ tests/cases/**/*.js
!tests/cases/docker/*.js/
tests/cases/**/*.js.map
*.config
scripts/eslint/built/
scripts/debug.bat
scripts/run.bat
scripts/word2md.js
Expand All @@ -60,6 +61,8 @@ internal/
**/.vs
**/.vscode
!**/.vscode/tasks.json
!**/.vscode/settings.json
!**/.vscode/extensions.json
!tests/cases/projects/projectOption/**/node_modules
!tests/cases/projects/NodeModulesSearch/**/*
!tests/baselines/reference/project/nodeModules*/**/*
Expand Down
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ netci.groovy
scripts
src
tests
tslint.json
Jakefile.js
.eslintrc
.eslintignore
.editorconfig
.failed-tests
.git
Expand Down
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ branches:

install:
- npm uninstall typescript --no-save
- npm uninstall tslint --no-save
- npm install

cache:
Expand Down
9 changes: 9 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"recommendations": [
"dbaeumer.vscode-eslint"
],

"unwantedRecommendations": [
"ms-vscode.vscode-typescript-tslint-plugin"
]
}
13 changes: 13 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"eslint.validate": [
{
"language": "typescript",
"autoFix": true
}
],
"eslint.options": {
"rulePaths": ["../scripts/eslint/built/rules/"],
"ext": [".ts"]
},
"eslint.workingDirectories": ["./src", "./scripts"]
}
82 changes: 57 additions & 25 deletions Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,36 +318,68 @@ task("clean-tests").description = "Cleans the outputs for the test infrastructur

const watchTests = () => watchProject("src/testRunner", cmdLineOptions);

const buildRules = () => buildProject("scripts/tslint");
task("build-rules", buildRules);
task("build-rules").description = "Compiles tslint rules to js";
const buildEslintRules = () => buildProject("scripts/eslint");
task("build-eslint-rules", buildEslintRules);
task("build-eslint-rules").description = "Compiles eslint rules to js";

const cleanRules = () => cleanProject("scripts/tslint");
cleanTasks.push(cleanRules);
task("clean-rules", cleanRules);
task("clean-rules").description = "Cleans the outputs for the lint rules";
const cleanEslintRules = () => cleanProject("scripts/eslint");
cleanTasks.push(cleanEslintRules);
task("clean-eslint-rules", cleanEslintRules);
task("clean-eslint-rules").description = "Cleans the outputs for the eslint rules";

const runEslintRulesTests = () => runConsoleTests("scripts/eslint/built/tests", "mocha-fivemat-progress-reporter", /*runInParallel*/ false, /*watchMode*/ false);
task("run-eslint-rules-tests", series(buildEslintRules, runEslintRulesTests));
task("run-eslint-rules-tests").description = "Runs the eslint rule tests";

const lintFoldStart = async () => { if (fold.isTravis()) console.log(fold.start("lint")); };
const lintFoldEnd = async () => { if (fold.isTravis()) console.log(fold.end("lint")); };
const lint = series([
lintFoldStart,
...["scripts/tslint/tsconfig.json", "src/tsconfig-base.json"].map(project => {
const lintOne = () => {
const args = ["node_modules/tslint/bin/tslint", "--project", project, "--formatters-dir", "./built/local/tslint/formatters", "--format", "autolinkableStylish"];
if (cmdLineOptions.fix) args.push("--fix");
log(`Linting: node ${args.join(" ")}`);
return exec(process.execPath, args);
};
lintOne.dispayName = `lint(${project})`;
return lintOne;
}),
lintFoldEnd
]);
const eslint = (folder) => async () => {
const ESLINTRC_CI = ".eslintrc.ci.json";
const isCIEnv = cmdLineOptions.ci || process.env.CI === "true";

const args = [
"node_modules/eslint/bin/eslint",
"--format", "autolinkable-stylish",
"--rulesdir", "scripts/eslint/built/rules",
"--ext", ".ts",
];

if (
isCIEnv &&
fs.existsSync(path.resolve(folder, ESLINTRC_CI))
) {
args.push("--config", path.resolve(folder, ESLINTRC_CI));
}

if (cmdLineOptions.fix) {
args.push("--fix");
}

args.push(folder);

log(`Linting: ${args.join(" ")}`);
return exec(process.execPath, args);
}

const lintScripts = eslint("scripts");
lintScripts.displayName = "lint-scripts";
task("lint-scripts", series([buildEslintRules, lintFoldStart, lintScripts, lintFoldEnd]));
task("lint-scripts").description = "Runs eslint on the scripts sources.";

const lintCompiler = eslint("src");
lintCompiler.displayName = "lint-compiler";
task("lint-compiler", series([buildEslintRules, lintFoldStart, lintCompiler, lintFoldEnd]));
task("lint-compiler").description = "Runs eslint on the compiler sources.";
task("lint-compiler").flags = {
" --ci": "Runs eslint additional rules",
};

const lint = series([buildEslintRules, lintFoldStart, lintScripts, lintCompiler, lintFoldEnd]);
lint.displayName = "lint";
task("lint", series(buildRules, lint));
task("lint").description = "Runs tslint on the compiler sources.";
task("lint", series([buildEslintRules, lintFoldStart, lint, lintFoldEnd]));
task("lint").description = "Runs eslint on the compiler and scripts sources.";
task("lint").flags = {
" --f[iles]=<regex>": "pattern to match files to lint",
" --ci": "Runs eslint additional rules",
};

const buildCancellationToken = () => buildProject("src/cancellationToken");
Expand Down Expand Up @@ -393,7 +425,7 @@ const generateCodeCoverage = () => exec("istanbul", ["cover", "node_modules/moch
task("generate-code-coverage", series(preBuild, buildTests, generateCodeCoverage));
task("generate-code-coverage").description = "Generates code coverage data via istanbul";

const preTest = parallel(buildRules, buildTests, buildServices, buildLssl);
const preTest = parallel(buildTests, buildServices, buildLssl);
preTest.displayName = "preTest";

const postTest = (done) => cmdLineOptions.lint ? lint(done) : done();
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ gulp runtests # Run tests using the built compiler and test infrastruct
gulp runtests-parallel # Like runtests, but split across multiple threads. Uses a number of threads equal to the system
# core count by default. Use --workers=<number> to adjust this.
gulp baseline-accept # This replaces the baseline test results with the results obtained from gulp runtests.
gulp lint # Runs tslint on the TypeScript source.
gulp lint # Runs eslint on the TypeScript source.
gulp help # List the above commands.
```

Expand Down
33 changes: 33 additions & 0 deletions loc/lcl/CHS/Targets/ProjectItemsSchema.xaml.lcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<LCX SchemaVersion="6.0" Name="E:\A\_work\326\s\VS\TypeScriptTasks\bin\Release\Targets\ProjectItemsSchema.xaml" PsrId="22" FileType="1" SrcCul="en-US" TgtCul="zh-CN" xmlns="http://schemas.microsoft.com/locstudio/2006/6/lcx">
<OwnedComments>
<Cmt Name="Dev" />
<Cmt Name="LcxAdmin" />
<Cmt Name="Rccx" />
</OwnedComments>
<Settings Name="@vsLocTools@\default.lss" Type="Lss" />
<Item ItemId=";&lt;ContentType&gt;" ItemType="0" PsrId="210" Leaf="false">
<Disp Icon="Str" Disp="true" LocTbl="false" />
<Item ItemId="0;typescriptcompile@ContentType@DisplayName" ItemType="47;XML:Attr:DisplayName" PsrId="210" Leaf="true">
<Str Cat="AppData">
<Val><![CDATA[TypeScript file]]></Val>
<Tgt Cat="AppData" Stat="Loc" Orig="New">
<Val><![CDATA[TypeScript 文件]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
</Item>
<Item ItemId=";&lt;ItemType&gt;" ItemType="0" PsrId="210" Leaf="false">
<Disp Icon="Str" Disp="true" LocTbl="false" />
<Item ItemId="0;typescriptcompile@ItemType@DisplayName" ItemType="47;XML:Attr:DisplayName" PsrId="210" Leaf="true">
<Str Cat="AppData">
<Val><![CDATA[TypeScript file]]></Val>
<Tgt Cat="AppData" Stat="Loc" Orig="New">
<Val><![CDATA[TypeScript 文件]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
</Item>
</LCX>
Loading

0 comments on commit 2c967c4

Please sign in to comment.