Ejemplo n.º 1
0
 /// <summary>
 /// Validates the specified source using JSLint with the provided options.
 /// </summary>
 /// <param name="source">The source.</param>
 /// <param name="options">The options.</param>
 /// <returns>
 /// A <see cref="IJSLintData" /> containing any validation errors.
 /// </returns>
 public static IJSLintData Lint(string source, JSLintOptions options)
 {
     using (var context = new JSLintContext())
     {
         return context.Lint(source, options);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Validates the specified source using JSLint with the provided options.
 /// </summary>
 /// <param name="source">The source.</param>
 /// <param name="options">The options.</param>
 /// <returns>
 /// A <see cref="IJSLintData" /> containing any validation errors.
 /// </returns>
 public static IJSLintData Lint(string source, JSLintOptions options)
 {
     using (var context = new JSLintContext())
     {
         return(context.Lint(source, options));
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Validates the specified source using JSLint with the provided options and global variables.
 /// </summary>
 /// <param name="source">The source.</param>
 /// <param name="options">The options.</param>
 /// <param name="globalVariables">The global variables.</param>
 /// <returns>
 /// A <see cref="IJSLintData" /> containing any validation errors.
 /// </returns>
 public static IJSLintData Lint(string source, JSLintOptions options, IList<string> globalVariables)
 {
     using (var context = new JSLintContext())
     {
         return context.Lint(source, options, globalVariables);
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Validates the specified source using JSLint with the provided options and global variables.
 /// </summary>
 /// <param name="source">The source.</param>
 /// <param name="options">The options.</param>
 /// <param name="globalVariables">The global variables.</param>
 /// <returns>
 /// A <see cref="IJSLintData" /> containing any validation errors.
 /// </returns>
 public static IJSLintData Lint(string source, JSLintOptions options, IList <string> globalVariables)
 {
     using (var context = new JSLintContext())
     {
         return(context.Lint(source, options, globalVariables));
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Creates a new object that is a copy of the current instance.
        /// </summary>
        /// <returns>
        /// A new object that is a copy of this instance.
        /// </returns>
        public JSLintOptions TypedClone()
        {
            var clone = new JSLintOptions();
            clone.predefinedGlobals = new Dictionary<string, bool>(this.predefinedGlobals);
            this.CloneRoot(clone);

            return clone;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Validates the specified source using JSLint with the provided options.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="options">The options.</param>
        /// <returns>
        /// A <see cref="IJSLintData" /> containing any validation errors.
        /// </returns>
        public IJSLintData Lint(string source, JSLintOptions options)
        {
            var jsonOptions = this.jsonProvider.SerializeOptions(options);
            var jsonData    = this.context.Script.JSLintNet.run(source, jsonOptions);
            var data        = this.jsonProvider.DeserializeData(jsonData);

            return(data);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Validates the specified source using JSLint with the provided options.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="options">The options.</param>
        /// <returns>
        /// A <see cref="IJSLintData" /> containing any validation errors.
        /// </returns>
        public IJSLintData Lint(string source, JSLintOptions options)
        {
            var jsonOptions = this.jsonProvider.SerializeOptions(options);
            var jsonData = this.context.Script.JSLintNet.run(source, jsonOptions);
            var data = this.jsonProvider.DeserializeData(jsonData);

            return data;
        }
Ejemplo n.º 8
0
        private void MergeGlobals(JSLintOptions merge)
        {
            if (merge.PredefinedGlobals == null)
            {
                return;
            }

            foreach (var global in merge.PredefinedGlobals)
            {
                this.predefinedGlobals[global.Key] = global.Value;
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Creates a new object that is a copy of the current instance.
        /// </summary>
        /// <returns>
        /// A new object that is a copy of this instance.
        /// </returns>
        public JSLintOptions TypedClone()
        {
            var clone = new JSLintOptions();

            clone.TolerateBitwiseOperators = this.TolerateBitwiseOperators;
            clone.AssumeBrowser            = this.AssumeBrowser;
            clone.AssumeCouchDB            = this.AssumeCouchDB;
            clone.AssumeInDevelopment      = this.AssumeInDevelopment;
            clone.AssumeES6               = this.AssumeES6;
            clone.TolerateEval            = this.TolerateEval;
            clone.TolerateForStatement    = this.TolerateForStatement;
            clone.MaximumErrors           = this.MaximumErrors;
            clone.MaximumLineLength       = this.MaximumLineLength;
            clone.AssumeNode              = this.AssumeNode;
            clone.TolerateThis            = this.TolerateThis;
            clone.TolerateMessyWhitespace = this.TolerateMessyWhitespace;

            return(clone);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Creates a new object that is a copy of the current instance.
        /// </summary>
        /// <returns>
        /// A new object that is a copy of this instance.
        /// </returns>
        public JSLintOptions TypedClone()
        {
            var clone = new JSLintOptions();

            clone.TolerateBitwiseOperators = this.TolerateBitwiseOperators;
            clone.AssumeBrowser = this.AssumeBrowser;
            clone.AssumeCouchDB = this.AssumeCouchDB;
            clone.AssumeInDevelopment = this.AssumeInDevelopment;
            clone.AssumeES6 = this.AssumeES6;
            clone.TolerateEval = this.TolerateEval;
            clone.TolerateForStatement = this.TolerateForStatement;
            clone.MaximumErrors = this.MaximumErrors;
            clone.MaximumLineLength = this.MaximumLineLength;
            clone.TolerateMultipleVariables = this.TolerateMultipleVariables;
            clone.AssumeNode = this.AssumeNode;
            clone.TolerateThis = this.TolerateThis;
            clone.TolerateMessyWhitespace = this.TolerateMessyWhitespace;

            return clone;
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Merges the specified options into this instance.
        /// </summary>
        /// <param name="merge">The options to merge.</param>
        public void Merge(JSLintOptions merge)
        {
            if (merge.TolerateBitwiseOperators.HasValue)
            {
                this.TolerateBitwiseOperators = merge.TolerateBitwiseOperators;
            }

            if (merge.AssumeBrowser.HasValue)
            {
                this.AssumeBrowser = merge.AssumeBrowser;
            }

            if (merge.AssumeCouchDB.HasValue)
            {
                this.AssumeCouchDB = merge.AssumeCouchDB;
            }

            if (merge.AssumeInDevelopment.HasValue)
            {
                this.AssumeInDevelopment = merge.AssumeInDevelopment;
            }

            if (merge.AssumeES6.HasValue)
            {
                this.AssumeES6 = merge.AssumeES6;
            }

            if (merge.TolerateEval.HasValue)
            {
                this.TolerateEval = merge.TolerateEval;
            }

            if (merge.TolerateForStatement.HasValue)
            {
                this.TolerateForStatement = merge.TolerateForStatement;
            }

            if (merge.MaximumErrors.HasValue)
            {
                this.MaximumErrors = merge.MaximumErrors;
            }

            if (merge.MaximumLineLength.HasValue)
            {
                this.MaximumLineLength = merge.MaximumLineLength;
            }

            if (merge.TolerateMultipleVariables.HasValue)
            {
                this.TolerateMultipleVariables = merge.TolerateMultipleVariables;
            }

            if (merge.AssumeNode.HasValue)
            {
                this.AssumeNode = merge.AssumeNode;
            }

            if (merge.TolerateThis.HasValue)
            {
                this.TolerateThis = merge.TolerateThis;
            }

            if (merge.TolerateMessyWhitespace.HasValue)
            {
                this.TolerateMessyWhitespace = merge.TolerateMessyWhitespace;
            }
        }
Ejemplo n.º 12
0
        private void MergeRoot(JSLintOptions merge)
        {
            if (merge.TolerateAssignmentExpressions.HasValue)
            {
                this.TolerateAssignmentExpressions = merge.TolerateAssignmentExpressions;
            }

            if (merge.TolerateBitwiseOperators.HasValue)
            {
                this.TolerateBitwiseOperators = merge.TolerateBitwiseOperators;
            }

            if (merge.AssumeBrowser.HasValue)
            {
                this.AssumeBrowser = merge.AssumeBrowser;
            }

            if (merge.TolerateGoogleClosure.HasValue)
            {
                this.TolerateGoogleClosure = merge.TolerateGoogleClosure;
            }

            if (merge.TolerateContinue.HasValue)
            {
                this.TolerateContinue = merge.TolerateContinue;
            }

            if (merge.AssumeCouchDB.HasValue)
            {
                this.AssumeCouchDB = merge.AssumeCouchDB;
            }

            if (merge.TolerateDebuggerStatements.HasValue)
            {
                this.TolerateDebuggerStatements = merge.TolerateDebuggerStatements;
            }

            if (merge.AssumeConsole.HasValue)
            {
                this.AssumeConsole = merge.AssumeConsole;
            }

            if (merge.TolerateDoubleEquals.HasValue)
            {
                this.TolerateDoubleEquals = merge.TolerateDoubleEquals;
            }

            if (merge.TolerateEval.HasValue)
            {
                this.TolerateEval = merge.TolerateEval;
            }

            if (merge.TolerateUnfilteredForIn.HasValue)
            {
                this.TolerateUnfilteredForIn = merge.TolerateUnfilteredForIn;
            }

            if (merge.IndentationFactor.HasValue)
            {
                this.IndentationFactor = merge.IndentationFactor;
            }

            if (merge.MaximumErrors.HasValue)
            {
                this.MaximumErrors = merge.MaximumErrors;
            }

            if (merge.MaximumLineLength.HasValue)
            {
                this.MaximumLineLength = merge.MaximumLineLength;
            }

            if (merge.TolerateUncapitalizedConstructors.HasValue)
            {
                this.TolerateUncapitalizedConstructors = merge.TolerateUncapitalizedConstructors;
            }

            if (merge.AssumeNode.HasValue)
            {
                this.AssumeNode = merge.AssumeNode;
            }

            if (merge.TolerateDanglingUnderscores.HasValue)
            {
                this.TolerateDanglingUnderscores = merge.TolerateDanglingUnderscores;
            }

            if (merge.StopOnFirstError.HasValue)
            {
                this.StopOnFirstError = merge.StopOnFirstError;
            }

            if (merge.TolerateIncrementDecrement.HasValue)
            {
                this.TolerateIncrementDecrement = merge.TolerateIncrementDecrement;
            }

            if (merge.PropertiesDeclared.HasValue)
            {
                this.PropertiesDeclared = merge.PropertiesDeclared;
            }

            if (merge.TolerateInsecureRegExp.HasValue)
            {
                this.TolerateInsecureRegExp = merge.TolerateInsecureRegExp;
            }

            if (merge.AssumeRhino.HasValue)
            {
                this.AssumeRhino = merge.AssumeRhino;
            }

            if (merge.TolerateUnusedParameters.HasValue)
            {
                this.TolerateUnusedParameters = merge.TolerateUnusedParameters;
            }

            if (merge.TolerateMissingUseStrict.HasValue)
            {
                this.TolerateMissingUseStrict = merge.TolerateMissingUseStrict;
            }

            if (merge.TolerateStupidPractices.HasValue)
            {
                this.TolerateStupidPractices = merge.TolerateStupidPractices;
            }

            if (merge.TolerateInefficientSubscripting.HasValue)
            {
                this.TolerateInefficientSubscripting = merge.TolerateInefficientSubscripting;
            }

            if (merge.TolerateToDoComments.HasValue)
            {
                this.TolerateToDoComments = merge.TolerateToDoComments;
            }

            if (merge.TolerateManyVarStatements.HasValue)
            {
                this.TolerateManyVarStatements = merge.TolerateManyVarStatements;
            }

            if (merge.TolerateMessyWhitespace.HasValue)
            {
                this.TolerateMessyWhitespace = merge.TolerateMessyWhitespace;
            }
        }
Ejemplo n.º 13
0
 /// <summary>
 /// Validates the specified source using JSLint with the provided options.
 /// </summary>
 /// <param name="source">The source.</param>
 /// <param name="options">The options.</param>
 /// <returns>
 /// A <see cref="IJSLintData" /> containing any validation errors.
 /// </returns>
 public static IJSLintData Lint(string source, JSLintOptions options)
 {
     return Lint(source, options, null);
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Merges the specified options into this instance.
 /// </summary>
 /// <param name="merge">The options to merge.</param>
 public void Merge(JSLintOptions merge)
 {
     this.MergeGlobals(merge);
     this.MergeRoot(merge);
 }
Ejemplo n.º 15
0
        /// <summary>
        /// Validates the specified source using JSLint with the provided options and global variables.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="options">The options.</param>
        /// <param name="globalVariables">The global variables.</param>
        /// <returns>
        /// A <see cref="IJSLintData" /> instance containing any validation warnings.
        /// </returns>
        public IJSLintData Lint(string source, JSLintOptions options, IList<string> globalVariables)
        {
            var jsonOptions = this.jsonProvider.SerializeOptions(options);
            var jsonGlobalVariables = this.jsonProvider.SerializeObject(globalVariables);
            var jsonData = this.context.Script.jslintnet(source, jsonOptions, jsonGlobalVariables);
            var data = this.jsonProvider.DeserializeData(jsonData);

            return data;
        }
Ejemplo n.º 16
0
 /// <summary>
 /// Merges the specified options into this instance.
 /// </summary>
 /// <param name="merge">The options to merge.</param>
 public void Merge(JSLintOptions merge)
 {
     this.MergeGlobals(merge);
     this.MergeRoot(merge);
 }
Ejemplo n.º 17
0
        /// <summary>
        /// Merges the specified options into this instance.
        /// </summary>
        /// <param name="merge">The options to merge.</param>
        public void Merge(JSLintOptions merge)
        {
            if (merge.TolerateBitwiseOperators.HasValue)
            {
                this.TolerateBitwiseOperators = merge.TolerateBitwiseOperators;
            }

            if (merge.AssumeBrowser.HasValue)
            {
                this.AssumeBrowser = merge.AssumeBrowser;
            }

            if (merge.AssumeCouchDB.HasValue)
            {
                this.AssumeCouchDB = merge.AssumeCouchDB;
            }

            if (merge.AssumeInDevelopment.HasValue)
            {
                this.AssumeInDevelopment = merge.AssumeInDevelopment;
            }

            if (merge.AssumeES6.HasValue)
            {
                this.AssumeES6 = merge.AssumeES6;
            }

            if (merge.TolerateEval.HasValue)
            {
                this.TolerateEval = merge.TolerateEval;
            }

            if (merge.TolerateForStatement.HasValue)
            {
                this.TolerateForStatement = merge.TolerateForStatement;
            }

            if (merge.MaximumErrors.HasValue)
            {
                this.MaximumErrors = merge.MaximumErrors;
            }

            if (merge.MaximumLineLength.HasValue)
            {
                this.MaximumLineLength = merge.MaximumLineLength;
            }

            if (merge.TolerateMultipleVariables.HasValue)
            {
                this.TolerateMultipleVariables = merge.TolerateMultipleVariables;
            }

            if (merge.AssumeNode.HasValue)
            {
                this.AssumeNode = merge.AssumeNode;
            }

            if (merge.TolerateSingleQuoteStrings.HasValue)
            {
                this.TolerateSingleQuoteStrings = merge.TolerateSingleQuoteStrings;
            }

            if (merge.TolerateThis.HasValue)
            {
                this.TolerateThis = merge.TolerateThis;
            }

            if (merge.TolerateMessyWhitespace.HasValue)
            {
                this.TolerateMessyWhitespace = merge.TolerateMessyWhitespace;
            }
        }
Ejemplo n.º 18
0
 /// <summary>
 /// Validates the specified source using JSLint with the provided options.
 /// </summary>
 /// <param name="source">The source.</param>
 /// <param name="options">The options.</param>
 /// <returns>
 /// A <see cref="IJSLintData" /> containing any validation errors.
 /// </returns>
 public IJSLintData Lint(string source, JSLintOptions options)
 {
     return(this.Lint(source, options, null));
 }
Ejemplo n.º 19
0
        private void MergeGlobals(JSLintOptions merge)
        {
            if (merge.PredefinedGlobals == null)
            {
                return;
            }

            foreach (var global in merge.PredefinedGlobals)
            {
                this.predefinedGlobals[global.Key] = global.Value;
            }
        }