Skip to content

Commit

Permalink
Remove tsickle auto-quoting transformer.
Browse files Browse the repository at this point in the history
When this worked it worked well, but when it misfired users found it
very confusing (noone expected that it existed) and suprising to work
with.

Ultimately, it made the emit type-senstitive which is not a feature TS
developers expect.

Instead, we have replaced this with a tsetse check
https://tsetse.info/property-renaming-safe. It follows the same
detection rules, but errors instead of silently fixing the code.

I plan to further followup this thread with a proposal for
--strictPropAccess on Microsoft/TypeScript.
  • Loading branch information
rkirov committed Mar 21, 2019
1 parent c0ac57b commit ba13814
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 200 deletions.
1 change: 0 additions & 1 deletion src/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ ts_library(
"main.ts",
"module_type_translator.ts",
"modules_manifest.ts",
"quoting_transformer.ts",
"transformer_util.ts",
"tsickle.ts",
"type_translator.ts",
Expand Down
8 changes: 0 additions & 8 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ import {ModulesManifest} from './tsickle';

/** Tsickle settings passed on the command line. */
export interface Settings {
/** If provided, modify quoting of property accesses to match the type declaration. */
enableAutoQuoting?: boolean;

/** If provided, path to save externs to. */
externsPath?: string;

Expand All @@ -45,7 +42,6 @@ example:
tsickle flags are:
--externs=PATH save generated Closure externs.js to PATH
--typed [experimental] attempt to provide Closure types instead of {?}
--enableAutoQuoting automatically apply quotes to property accesses
--fatalWarnings whether warnings should be fatal, and cause tsickle to return a non-zero exit code
`);
}
Expand Down Expand Up @@ -73,9 +69,6 @@ function loadSettingsFromArgs(args: string[]): {settings: Settings, tscArgs: str
case 'verbose':
settings.verbose = true;
break;
case 'enableAutoQuoting':
settings.enableAutoQuoting = true;
break;
case 'fatalWarnings':
settings.fatalWarnings = true;
break;
Expand Down Expand Up @@ -179,7 +172,6 @@ export function toClosureJS(
transformDecorators: true,
transformTypesToClosure: true,
typeBlackListPaths: new Set(),
enableAutoQuoting: settings.enableAutoQuoting,
untyped: false,
logWarning: (warning) => console.error(ts.formatDiagnostics([warning], compilerHost)),
options,
Expand Down
96 changes: 0 additions & 96 deletions src/quoting_transformer.ts

This file was deleted.

4 changes: 0 additions & 4 deletions src/tsickle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {transformFileoverviewCommentFactory} from './fileoverview_comment_transf
import * as googmodule from './googmodule';
import {jsdocTransformer, removeTypeAssertions} from './jsdoc_transformer';
import {ModulesManifest} from './modules_manifest';
import {quotingTransformer} from './quoting_transformer';
import {isDtsFileName} from './transformer_util';

// Retained here for API compatibility.
Expand Down Expand Up @@ -108,9 +107,6 @@ export function emitWithTsickle(
tsickleSourceTransformers.push(transformFileoverviewCommentFactory(tsickleDiagnostics));
tsickleSourceTransformers.push(
jsdocTransformer(host, tsOptions, tsHost, typeChecker, tsickleDiagnostics));
if (host.enableAutoQuoting) {
tsickleSourceTransformers.push(quotingTransformer(host, typeChecker, tsickleDiagnostics));
}
tsickleSourceTransformers.push(enumTransformer(typeChecker, tsickleDiagnostics));
tsickleSourceTransformers.push(decoratorDownlevelTransformer(typeChecker, tsickleDiagnostics));
} else if (host.transformDecorators) {
Expand Down
53 changes: 0 additions & 53 deletions test_files/quote_props/quote.js

This file was deleted.

38 changes: 0 additions & 38 deletions test_files/quote_props/quote.ts

This file was deleted.

0 comments on commit ba13814

Please sign in to comment.