Adjust European short trip heuristic from >3 days to >1 day to correctly detect when user has returned home from European trips. This fixes the April 29-30, 2023 case where the location incorrectly showed "Sankt Georg, Hamburg" instead of "Bristol" when the user was free (no events scheduled) after the foss-north trip ended on April 27. The previous logic required more than 3 days to pass before assuming return home from European countries, but for short European trips by rail/ferry, users typically return within 1-2 days. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
		
			
				
	
	
		
			64 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			64 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
/**
 | 
						|
 * @fileoverview Provide the function that emits deprecation warnings.
 | 
						|
 * @author Toru Nagashima <http://github.com/mysticatea>
 | 
						|
 */
 | 
						|
 | 
						|
//------------------------------------------------------------------------------
 | 
						|
// Requirements
 | 
						|
//------------------------------------------------------------------------------
 | 
						|
 | 
						|
import path from "path";
 | 
						|
 | 
						|
//------------------------------------------------------------------------------
 | 
						|
// Private
 | 
						|
//------------------------------------------------------------------------------
 | 
						|
 | 
						|
// Defitions for deprecation warnings.
 | 
						|
const deprecationWarningMessages = {
 | 
						|
    ESLINT_LEGACY_ECMAFEATURES:
 | 
						|
        "The 'ecmaFeatures' config file property is deprecated and has no effect.",
 | 
						|
    ESLINT_PERSONAL_CONFIG_LOAD:
 | 
						|
        "'~/.eslintrc.*' config files have been deprecated. " +
 | 
						|
        "Please use a config file per project or the '--config' option.",
 | 
						|
    ESLINT_PERSONAL_CONFIG_SUPPRESS:
 | 
						|
        "'~/.eslintrc.*' config files have been deprecated. " +
 | 
						|
        "Please remove it or add 'root:true' to the config files in your " +
 | 
						|
        "projects in order to avoid loading '~/.eslintrc.*' accidentally."
 | 
						|
};
 | 
						|
 | 
						|
const sourceFileErrorCache = new Set();
 | 
						|
 | 
						|
/**
 | 
						|
 * Emits a deprecation warning containing a given filepath. A new deprecation warning is emitted
 | 
						|
 * for each unique file path, but repeated invocations with the same file path have no effect.
 | 
						|
 * No warnings are emitted if the `--no-deprecation` or `--no-warnings` Node runtime flags are active.
 | 
						|
 * @param {string} source The name of the configuration source to report the warning for.
 | 
						|
 * @param {string} errorCode The warning message to show.
 | 
						|
 * @returns {void}
 | 
						|
 */
 | 
						|
function emitDeprecationWarning(source, errorCode) {
 | 
						|
    const cacheKey = JSON.stringify({ source, errorCode });
 | 
						|
 | 
						|
    if (sourceFileErrorCache.has(cacheKey)) {
 | 
						|
        return;
 | 
						|
    }
 | 
						|
    sourceFileErrorCache.add(cacheKey);
 | 
						|
 | 
						|
    const rel = path.relative(process.cwd(), source);
 | 
						|
    const message = deprecationWarningMessages[errorCode];
 | 
						|
 | 
						|
    process.emitWarning(
 | 
						|
        `${message} (found in "${rel}")`,
 | 
						|
        "DeprecationWarning",
 | 
						|
        errorCode
 | 
						|
    );
 | 
						|
}
 | 
						|
 | 
						|
//------------------------------------------------------------------------------
 | 
						|
// Public Interface
 | 
						|
//------------------------------------------------------------------------------
 | 
						|
 | 
						|
export {
 | 
						|
    emitDeprecationWarning
 | 
						|
};
 |