Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jshint

Package Overview
Dependencies
Maintainers
2
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jshint - npm Package Compare versions

Comparing version 2.4.2 to 2.4.3

20

data/ascii-identifier-data.js
var identifierStartTable = [];
for (var i = 0; i < 128; i++) {
identifierStartTable[i] =
i === 36 || // $
i >= 65 && i <= 90 || // A-Z
i === 95 || // _
i >= 97 && i <= 122; // a-z
identifierStartTable[i] =
i === 36 || // $
i >= 65 && i <= 90 || // A-Z
i === 95 || // _
i >= 97 && i <= 122; // a-z
}

@@ -14,10 +14,10 @@

for (var i = 0; i < 128; i++) {
identifierPartTable[i] =
identifierStartTable[i] || // $, _, A-Z, a-z
i >= 48 && i <= 57; // 0-9
identifierPartTable[i] =
identifierStartTable[i] || // $, _, A-Z, a-z
i >= 48 && i <= 57; // 0-9
}
module.exports = {
asciiIdentifierStartTable: identifierStartTable,
asciiIdentifierPartTable: identifierPartTable
asciiIdentifierStartTable: identifierStartTable,
asciiIdentifierPartTable: identifierPartTable
};
module.exports = [
768,
769,
770,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
781,
782,
783,
784,
785,
786,
787,
788,
789,
790,
791,
792,
793,
794,
795,
796,
797,
798,
799,
800,
801,
802,
803,
804,
805,
806,
807,
808,
809,
810,
811,
812,
813,
814,
815,
816,
817,
818,
819,
820,
821,
822,
823,
824,
825,
826,
827,
828,
829,
830,
831,
832,
833,
834,
835,
836,
837,
838,
839,
840,
841,
842,
843,
844,
845,
846,
847,
848,
849,
850,
851,
852,
853,
854,
855,
856,
857,
858,
859,
860,
861,
862,
863,
864,
865,
866,
867,
868,
869,
870,
871,
872,
873,
874,
875,
876,
877,
878,
879,
1155,
1156,
1157,
1158,
1159,
1425,
1426,
1427,
1428,
1429,
1430,
1431,
1432,
1433,
1434,
1435,
1436,
1437,
1438,
1439,
1440,
1441,
1442,
1443,
1444,
1445,
1446,
1447,
1448,
1449,
1450,
1451,
1452,
1453,
1454,
1455,
1456,
1457,
1458,
1459,
1460,
1461,
1462,
1463,
1464,
1465,
1466,
1467,
1468,
1469,
1471,
1473,
1474,
1476,
1477,
1479,
1552,
1553,
1554,
1555,
1556,
1557,
1558,
1559,
1560,
1561,
1562,
1611,
1612,
1613,
1614,
1615,
1616,
1617,
1618,
1619,
1620,
1621,
1622,
1623,
1624,
1625,
1626,
1627,
1628,
1629,
1630,
1631,
1632,
1633,
1634,
1635,
1636,
1637,
1638,
1639,
1640,
1641,
1648,
1750,
1751,
1752,
1753,
1754,
1755,
1756,
1759,
1760,
1761,
1762,
1763,
1764,
1767,
1768,
1770,
1771,
1772,
1773,
1776,
1777,
1778,
1779,
1780,
1781,
1782,
1783,
1784,
1785,
1809,
1840,
1841,
1842,
1843,
1844,
1845,
1846,
1847,
1848,
1849,
1850,
1851,
1852,
1853,
1854,
1855,
1856,
1857,
1858,
1859,
1860,
1861,
1862,
1863,
1864,
1865,
1866,
1958,
1959,
1960,
1961,
1962,
1963,
1964,
1965,
1966,
1967,
1968,
1984,
1985,
1986,
1987,
1988,
1989,
1990,
1991,
1992,
1993,
2027,
2028,
2029,
2030,
2031,
2032,
2033,
2034,
2035,
2070,
2071,
2072,
2073,
2075,
2076,
2077,
2078,
2079,
2080,
2081,
2082,
2083,
2085,
2086,
2087,
2089,
2090,
2091,
2092,
2093,
2137,
2138,
2139,
2276,
2277,
2278,
2279,
2280,
2281,
2282,
2283,
2284,
2285,
2286,
2287,
2288,
2289,
2290,
2291,
2292,
2293,
2294,
2295,
2296,
2297,
2298,
2299,
2300,
2301,
2302,
2304,
2305,
2306,
2307,
2362,
2363,
2364,
2366,
2367,
2368,
2369,
2370,
2371,
2372,
2373,
2374,
2375,
2376,
2377,
2378,
2379,
2380,
2381,
2382,
2383,
2385,
2386,
2387,
2388,
2389,
2390,
2391,
2402,
2403,
2406,
2407,
2408,
2409,
2410,
2411,
2412,
2413,
2414,
2415,
2433,
2434,
2435,
2492,
2494,
2495,
2496,
2497,
2498,
2499,
2500,
2503,
2504,
2507,
2508,
2509,
2519,
2530,
2531,
2534,
2535,
2536,
2537,
2538,
2539,
2540,
2541,
2542,
2543,
2561,
2562,
2563,
2620,
2622,
2623,
2624,
2625,
2626,
2631,
2632,
2635,
2636,
2637,
2641,
2662,
2663,
2664,
2665,
2666,
2667,
2668,
2669,
2670,
2671,
2672,
2673,
2677,
2689,
2690,
2691,
2748,
2750,
2751,
2752,
2753,
2754,
2755,
2756,
2757,
2759,
2760,
2761,
2763,
2764,
2765,
2786,
2787,
2790,
2791,
2792,
2793,
2794,
2795,
2796,
2797,
2798,
2799,
2817,
2818,
2819,
2876,
2878,
2879,
2880,
2881,
2882,
2883,
2884,
2887,
2888,
2891,
2892,
2893,
2902,
2903,
2914,
2915,
2918,
2919,
2920,
2921,
2922,
2923,
2924,
2925,
2926,
2927,
2946,
3006,
3007,
3008,
3009,
3010,
3014,
3015,
3016,
3018,
3019,
3020,
3021,
3031,
3046,
3047,
3048,
3049,
3050,
3051,
3052,
3053,
3054,
3055,
3073,
3074,
3075,
3134,
3135,
3136,
3137,
3138,
3139,
3140,
3142,
3143,
3144,
3146,
3147,
3148,
3149,
3157,
3158,
3170,
3171,
3174,
3175,
3176,
3177,
3178,
3179,
3180,
3181,
3182,
3183,
3202,
3203,
3260,
3262,
3263,
3264,
3265,
3266,
3267,
3268,
3270,
3271,
3272,
3274,
3275,
3276,
3277,
3285,
3286,
3298,
3299,
3302,
3303,
3304,
3305,
3306,
3307,
3308,
3309,
3310,
3311,
3330,
3331,
3390,
3391,
3392,
3393,
3394,
3395,
3396,
3398,
3399,
3400,
3402,
3403,
3404,
3405,
3415,
3426,
3427,
3430,
3431,
3432,
3433,
3434,
3435,
3436,
3437,
3438,
3439,
3458,
3459,
3530,
3535,
3536,
3537,
3538,
3539,
3540,
3542,
3544,
3545,
3546,
3547,
3548,
3549,
3550,
3551,
3570,
3571,
3633,
3636,
3637,
3638,
3639,
3640,
3641,
3642,
3655,
3656,
3657,
3658,
3659,
3660,
3661,
3662,
3664,
3665,
3666,
3667,
3668,
3669,
3670,
3671,
3672,
3673,
3761,
3764,
3765,
3766,
3767,
3768,
3769,
3771,
3772,
3784,
3785,
3786,
3787,
3788,
3789,
3792,
3793,
3794,
3795,
3796,
3797,
3798,
3799,
3800,
3801,
3864,
3865,
3872,
3873,
3874,
3875,
3876,
3877,
3878,
3879,
3880,
3881,
3893,
3895,
3897,
3902,
3903,
3953,
3954,
3955,
3956,
3957,
3958,
3959,
3960,
3961,
3962,
3963,
3964,
3965,
3966,
3967,
3968,
3969,
3970,
3971,
3972,
3974,
3975,
3981,
3982,
3983,
3984,
3985,
3986,
3987,
3988,
3989,
3990,
3991,
3993,
3994,
3995,
3996,
3997,
3998,
3999,
4000,
4001,
4002,
4003,
4004,
4005,
4006,
4007,
4008,
4009,
4010,
4011,
4012,
4013,
4014,
4015,
4016,
4017,
4018,
4019,
4020,
4021,
4022,
4023,
4024,
4025,
4026,
4027,
4028,
4038,
4139,
4140,
4141,
4142,
4143,
4144,
4145,
4146,
4147,
4148,
4149,
4150,
4151,
4152,
4153,
4154,
4155,
4156,
4157,
4158,
4160,
4161,
4162,
4163,
4164,
4165,
4166,
4167,
4168,
4169,
4182,
4183,
4184,
4185,
4190,
4191,
4192,
4194,
4195,
4196,
4199,
4200,
4201,
4202,
4203,
4204,
4205,
4209,
4210,
4211,
4212,
4226,
4227,
4228,
4229,
4230,
4231,
4232,
4233,
4234,
4235,
4236,
4237,
4239,
4240,
4241,
4242,
4243,
4244,
4245,
4246,
4247,
4248,
4249,
4250,
4251,
4252,
4253,
4957,
4958,
4959,
5906,
5907,
5908,
5938,
5939,
5940,
5970,
5971,
6002,
6003,
6068,
6069,
6070,
6071,
6072,
6073,
6074,
6075,
6076,
6077,
6078,
6079,
6080,
6081,
6082,
6083,
6084,
6085,
6086,
6087,
6088,
6089,
6090,
6091,
6092,
6093,
6094,
6095,
6096,
6097,
6098,
6099,
6109,
6112,
6113,
6114,
6115,
6116,
6117,
6118,
6119,
6120,
6121,
6155,
6156,
6157,
6160,
6161,
6162,
6163,
6164,
6165,
6166,
6167,
6168,
6169,
6313,
6432,
6433,
6434,
6435,
6436,
6437,
6438,
6439,
6440,
6441,
6442,
6443,
6448,
6449,
6450,
6451,
6452,
6453,
6454,
6455,
6456,
6457,
6458,
6459,
6470,
6471,
6472,
6473,
6474,
6475,
6476,
6477,
6478,
6479,
6576,
6577,
6578,
6579,
6580,
6581,
6582,
6583,
6584,
6585,
6586,
6587,
6588,
6589,
6590,
6591,
6592,
6600,
6601,
6608,
6609,
6610,
6611,
6612,
6613,
6614,
6615,
6616,
6617,
6679,
6680,
6681,
6682,
6683,
6741,
6742,
6743,
6744,
6745,
6746,
6747,
6748,
6749,
6750,
6752,
6753,
6754,
6755,
6756,
6757,
6758,
6759,
6760,
6761,
6762,
6763,
6764,
6765,
6766,
6767,
6768,
6769,
6770,
6771,
6772,
6773,
6774,
6775,
6776,
6777,
6778,
6779,
6780,
6783,
6784,
6785,
6786,
6787,
6788,
6789,
6790,
6791,
6792,
6793,
6800,
6801,
6802,
6803,
6804,
6805,
6806,
6807,
6808,
6809,
6912,
6913,
6914,
6915,
6916,
6964,
6965,
6966,
6967,
6968,
6969,
6970,
6971,
6972,
6973,
6974,
6975,
6976,
6977,
6978,
6979,
6980,
6992,
6993,
6994,
6995,
6996,
6997,
6998,
6999,
7000,
7001,
7019,
7020,
7021,
7022,
7023,
7024,
7025,
7026,
7027,
7040,
7041,
7042,
7073,
7074,
7075,
7076,
7077,
7078,
7079,
7080,
7081,
7082,
7083,
7084,
7085,
7088,
7089,
7090,
7091,
7092,
7093,
7094,
7095,
7096,
7097,
7142,
7143,
7144,
7145,
7146,
7147,
7148,
7149,
7150,
7151,
7152,
7153,
7154,
7155,
7204,
7205,
7206,
7207,
7208,
7209,
7210,
7211,
7212,
7213,
7214,
7215,
7216,
7217,
7218,
7219,
7220,
7221,
7222,
7223,
7232,
7233,
7234,
7235,
7236,
7237,
7238,
7239,
7240,
7241,
7248,
7249,
7250,
7251,
7252,
7253,
7254,
7255,
7256,
7257,
7376,
7377,
7378,
7380,
7381,
7382,
7383,
7384,
7385,
7386,
7387,
7388,
7389,
7390,
7391,
7392,
7393,
7394,
7395,
7396,
7397,
7398,
7399,
7400,
7405,
7410,
7411,
7412,
7616,
7617,
7618,
7619,
7620,
7621,
7622,
7623,
7624,
7625,
7626,
7627,
7628,
7629,
7630,
7631,
7632,
7633,
7634,
7635,
7636,
7637,
7638,
7639,
7640,
7641,
7642,
7643,
7644,
7645,
7646,
7647,
7648,
7649,
7650,
7651,
7652,
7653,
7654,
7676,
7677,
7678,
7679,
8204,
8205,
8255,
8256,
8276,
8400,
8401,
8402,
8403,
8404,
8405,
8406,
8407,
8408,
8409,
8410,
8411,
8412,
8417,
8421,
8422,
8423,
8424,
8425,
8426,
8427,
8428,
8429,
8430,
8431,
8432,
11503,
11504,
11505,
11647,
11744,
11745,
11746,
11747,
11748,
11749,
11750,
11751,
11752,
11753,
11754,
11755,
11756,
11757,
11758,
11759,
11760,
11761,
11762,
11763,
11764,
11765,
11766,
11767,
11768,
11769,
11770,
11771,
11772,
11773,
11774,
11775,
12330,
12331,
12332,
12333,
12334,
12335,
12441,
12442,
42528,
42529,
42530,
42531,
42532,
42533,
42534,
42535,
42536,
42537,
42607,
42612,
42613,
42614,
42615,
42616,
42617,
42618,
42619,
42620,
42621,
42655,
42736,
42737,
43010,
43014,
43019,
43043,
43044,
43045,
43046,
43047,
43136,
43137,
43188,
43189,
43190,
43191,
43192,
43193,
43194,
43195,
43196,
43197,
43198,
43199,
43200,
43201,
43202,
43203,
43204,
43216,
43217,
43218,
43219,
43220,
43221,
43222,
43223,
43224,
43225,
43232,
43233,
43234,
43235,
43236,
43237,
43238,
43239,
43240,
43241,
43242,
43243,
43244,
43245,
43246,
43247,
43248,
43249,
43264,
43265,
43266,
43267,
43268,
43269,
43270,
43271,
43272,
43273,
43302,
43303,
43304,
43305,
43306,
43307,
43308,
43309,
43335,
43336,
43337,
43338,
43339,
43340,
43341,
43342,
43343,
43344,
43345,
43346,
43347,
43392,
43393,
43394,
43395,
43443,
43444,
43445,
43446,
43447,
43448,
43449,
43450,
43451,
43452,
43453,
43454,
43455,
43456,
43472,
43473,
43474,
43475,
43476,
43477,
43478,
43479,
43480,
43481,
43561,
43562,
43563,
43564,
43565,
43566,
43567,
43568,
43569,
43570,
43571,
43572,
43573,
43574,
43587,
43596,
43597,
43600,
43601,
43602,
43603,
43604,
43605,
43606,
43607,
43608,
43609,
43643,
43696,
43698,
43699,
43700,
43703,
43704,
43710,
43711,
43713,
43755,
43756,
43757,
43758,
43759,
43765,
43766,
44003,
44004,
44005,
44006,
44007,
44008,
44009,
44010,
44012,
44013,
44016,
44017,
44018,
44019,
44020,
44021,
44022,
44023,
44024,
44025,
64286,
65024,
65025,
65026,
65027,
65028,
65029,
65030,
65031,
65032,
65033,
65034,
65035,
65036,
65037,
65038,
65039,
65056,
65057,
65058,
65059,
65060,
65061,
65062,
65075,
65076,
65101,
65102,
65103,
65296,
65297,
65298,
65299,
65300,
65301,
65302,
65303,
65304,
65305,
65343
768,
769,
770,
771,
772,
773,
774,
775,
776,
777,
778,
779,
780,
781,
782,
783,
784,
785,
786,
787,
788,
789,
790,
791,
792,
793,
794,
795,
796,
797,
798,
799,
800,
801,
802,
803,
804,
805,
806,
807,
808,
809,
810,
811,
812,
813,
814,
815,
816,
817,
818,
819,
820,
821,
822,
823,
824,
825,
826,
827,
828,
829,
830,
831,
832,
833,
834,
835,
836,
837,
838,
839,
840,
841,
842,
843,
844,
845,
846,
847,
848,
849,
850,
851,
852,
853,
854,
855,
856,
857,
858,
859,
860,
861,
862,
863,
864,
865,
866,
867,
868,
869,
870,
871,
872,
873,
874,
875,
876,
877,
878,
879,
1155,
1156,
1157,
1158,
1159,
1425,
1426,
1427,
1428,
1429,
1430,
1431,
1432,
1433,
1434,
1435,
1436,
1437,
1438,
1439,
1440,
1441,
1442,
1443,
1444,
1445,
1446,
1447,
1448,
1449,
1450,
1451,
1452,
1453,
1454,
1455,
1456,
1457,
1458,
1459,
1460,
1461,
1462,
1463,
1464,
1465,
1466,
1467,
1468,
1469,
1471,
1473,
1474,
1476,
1477,
1479,
1552,
1553,
1554,
1555,
1556,
1557,
1558,
1559,
1560,
1561,
1562,
1611,
1612,
1613,
1614,
1615,
1616,
1617,
1618,
1619,
1620,
1621,
1622,
1623,
1624,
1625,
1626,
1627,
1628,
1629,
1630,
1631,
1632,
1633,
1634,
1635,
1636,
1637,
1638,
1639,
1640,
1641,
1648,
1750,
1751,
1752,
1753,
1754,
1755,
1756,
1759,
1760,
1761,
1762,
1763,
1764,
1767,
1768,
1770,
1771,
1772,
1773,
1776,
1777,
1778,
1779,
1780,
1781,
1782,
1783,
1784,
1785,
1809,
1840,
1841,
1842,
1843,
1844,
1845,
1846,
1847,
1848,
1849,
1850,
1851,
1852,
1853,
1854,
1855,
1856,
1857,
1858,
1859,
1860,
1861,
1862,
1863,
1864,
1865,
1866,
1958,
1959,
1960,
1961,
1962,
1963,
1964,
1965,
1966,
1967,
1968,
1984,
1985,
1986,
1987,
1988,
1989,
1990,
1991,
1992,
1993,
2027,
2028,
2029,
2030,
2031,
2032,
2033,
2034,
2035,
2070,
2071,
2072,
2073,
2075,
2076,
2077,
2078,
2079,
2080,
2081,
2082,
2083,
2085,
2086,
2087,
2089,
2090,
2091,
2092,
2093,
2137,
2138,
2139,
2276,
2277,
2278,
2279,
2280,
2281,
2282,
2283,
2284,
2285,
2286,
2287,
2288,
2289,
2290,
2291,
2292,
2293,
2294,
2295,
2296,
2297,
2298,
2299,
2300,
2301,
2302,
2304,
2305,
2306,
2307,
2362,
2363,
2364,
2366,
2367,
2368,
2369,
2370,
2371,
2372,
2373,
2374,
2375,
2376,
2377,
2378,
2379,
2380,
2381,
2382,
2383,
2385,
2386,
2387,
2388,
2389,
2390,
2391,
2402,
2403,
2406,
2407,
2408,
2409,
2410,
2411,
2412,
2413,
2414,
2415,
2433,
2434,
2435,
2492,
2494,
2495,
2496,
2497,
2498,
2499,
2500,
2503,
2504,
2507,
2508,
2509,
2519,
2530,
2531,
2534,
2535,
2536,
2537,
2538,
2539,
2540,
2541,
2542,
2543,
2561,
2562,
2563,
2620,
2622,
2623,
2624,
2625,
2626,
2631,
2632,
2635,
2636,
2637,
2641,
2662,
2663,
2664,
2665,
2666,
2667,
2668,
2669,
2670,
2671,
2672,
2673,
2677,
2689,
2690,
2691,
2748,
2750,
2751,
2752,
2753,
2754,
2755,
2756,
2757,
2759,
2760,
2761,
2763,
2764,
2765,
2786,
2787,
2790,
2791,
2792,
2793,
2794,
2795,
2796,
2797,
2798,
2799,
2817,
2818,
2819,
2876,
2878,
2879,
2880,
2881,
2882,
2883,
2884,
2887,
2888,
2891,
2892,
2893,
2902,
2903,
2914,
2915,
2918,
2919,
2920,
2921,
2922,
2923,
2924,
2925,
2926,
2927,
2946,
3006,
3007,
3008,
3009,
3010,
3014,
3015,
3016,
3018,
3019,
3020,
3021,
3031,
3046,
3047,
3048,
3049,
3050,
3051,
3052,
3053,
3054,
3055,
3073,
3074,
3075,
3134,
3135,
3136,
3137,
3138,
3139,
3140,
3142,
3143,
3144,
3146,
3147,
3148,
3149,
3157,
3158,
3170,
3171,
3174,
3175,
3176,
3177,
3178,
3179,
3180,
3181,
3182,
3183,
3202,
3203,
3260,
3262,
3263,
3264,
3265,
3266,
3267,
3268,
3270,
3271,
3272,
3274,
3275,
3276,
3277,
3285,
3286,
3298,
3299,
3302,
3303,
3304,
3305,
3306,
3307,
3308,
3309,
3310,
3311,
3330,
3331,
3390,
3391,
3392,
3393,
3394,
3395,
3396,
3398,
3399,
3400,
3402,
3403,
3404,
3405,
3415,
3426,
3427,
3430,
3431,
3432,
3433,
3434,
3435,
3436,
3437,
3438,
3439,
3458,
3459,
3530,
3535,
3536,
3537,
3538,
3539,
3540,
3542,
3544,
3545,
3546,
3547,
3548,
3549,
3550,
3551,
3570,
3571,
3633,
3636,
3637,
3638,
3639,
3640,
3641,
3642,
3655,
3656,
3657,
3658,
3659,
3660,
3661,
3662,
3664,
3665,
3666,
3667,
3668,
3669,
3670,
3671,
3672,
3673,
3761,
3764,
3765,
3766,
3767,
3768,
3769,
3771,
3772,
3784,
3785,
3786,
3787,
3788,
3789,
3792,
3793,
3794,
3795,
3796,
3797,
3798,
3799,
3800,
3801,
3864,
3865,
3872,
3873,
3874,
3875,
3876,
3877,
3878,
3879,
3880,
3881,
3893,
3895,
3897,
3902,
3903,
3953,
3954,
3955,
3956,
3957,
3958,
3959,
3960,
3961,
3962,
3963,
3964,
3965,
3966,
3967,
3968,
3969,
3970,
3971,
3972,
3974,
3975,
3981,
3982,
3983,
3984,
3985,
3986,
3987,
3988,
3989,
3990,
3991,
3993,
3994,
3995,
3996,
3997,
3998,
3999,
4000,
4001,
4002,
4003,
4004,
4005,
4006,
4007,
4008,
4009,
4010,
4011,
4012,
4013,
4014,
4015,
4016,
4017,
4018,
4019,
4020,
4021,
4022,
4023,
4024,
4025,
4026,
4027,
4028,
4038,
4139,
4140,
4141,
4142,
4143,
4144,
4145,
4146,
4147,
4148,
4149,
4150,
4151,
4152,
4153,
4154,
4155,
4156,
4157,
4158,
4160,
4161,
4162,
4163,
4164,
4165,
4166,
4167,
4168,
4169,
4182,
4183,
4184,
4185,
4190,
4191,
4192,
4194,
4195,
4196,
4199,
4200,
4201,
4202,
4203,
4204,
4205,
4209,
4210,
4211,
4212,
4226,
4227,
4228,
4229,
4230,
4231,
4232,
4233,
4234,
4235,
4236,
4237,
4239,
4240,
4241,
4242,
4243,
4244,
4245,
4246,
4247,
4248,
4249,
4250,
4251,
4252,
4253,
4957,
4958,
4959,
5906,
5907,
5908,
5938,
5939,
5940,
5970,
5971,
6002,
6003,
6068,
6069,
6070,
6071,
6072,
6073,
6074,
6075,
6076,
6077,
6078,
6079,
6080,
6081,
6082,
6083,
6084,
6085,
6086,
6087,
6088,
6089,
6090,
6091,
6092,
6093,
6094,
6095,
6096,
6097,
6098,
6099,
6109,
6112,
6113,
6114,
6115,
6116,
6117,
6118,
6119,
6120,
6121,
6155,
6156,
6157,
6160,
6161,
6162,
6163,
6164,
6165,
6166,
6167,
6168,
6169,
6313,
6432,
6433,
6434,
6435,
6436,
6437,
6438,
6439,
6440,
6441,
6442,
6443,
6448,
6449,
6450,
6451,
6452,
6453,
6454,
6455,
6456,
6457,
6458,
6459,
6470,
6471,
6472,
6473,
6474,
6475,
6476,
6477,
6478,
6479,
6576,
6577,
6578,
6579,
6580,
6581,
6582,
6583,
6584,
6585,
6586,
6587,
6588,
6589,
6590,
6591,
6592,
6600,
6601,
6608,
6609,
6610,
6611,
6612,
6613,
6614,
6615,
6616,
6617,
6679,
6680,
6681,
6682,
6683,
6741,
6742,
6743,
6744,
6745,
6746,
6747,
6748,
6749,
6750,
6752,
6753,
6754,
6755,
6756,
6757,
6758,
6759,
6760,
6761,
6762,
6763,
6764,
6765,
6766,
6767,
6768,
6769,
6770,
6771,
6772,
6773,
6774,
6775,
6776,
6777,
6778,
6779,
6780,
6783,
6784,
6785,
6786,
6787,
6788,
6789,
6790,
6791,
6792,
6793,
6800,
6801,
6802,
6803,
6804,
6805,
6806,
6807,
6808,
6809,
6912,
6913,
6914,
6915,
6916,
6964,
6965,
6966,
6967,
6968,
6969,
6970,
6971,
6972,
6973,
6974,
6975,
6976,
6977,
6978,
6979,
6980,
6992,
6993,
6994,
6995,
6996,
6997,
6998,
6999,
7000,
7001,
7019,
7020,
7021,
7022,
7023,
7024,
7025,
7026,
7027,
7040,
7041,
7042,
7073,
7074,
7075,
7076,
7077,
7078,
7079,
7080,
7081,
7082,
7083,
7084,
7085,
7088,
7089,
7090,
7091,
7092,
7093,
7094,
7095,
7096,
7097,
7142,
7143,
7144,
7145,
7146,
7147,
7148,
7149,
7150,
7151,
7152,
7153,
7154,
7155,
7204,
7205,
7206,
7207,
7208,
7209,
7210,
7211,
7212,
7213,
7214,
7215,
7216,
7217,
7218,
7219,
7220,
7221,
7222,
7223,
7232,
7233,
7234,
7235,
7236,
7237,
7238,
7239,
7240,
7241,
7248,
7249,
7250,
7251,
7252,
7253,
7254,
7255,
7256,
7257,
7376,
7377,
7378,
7380,
7381,
7382,
7383,
7384,
7385,
7386,
7387,
7388,
7389,
7390,
7391,
7392,
7393,
7394,
7395,
7396,
7397,
7398,
7399,
7400,
7405,
7410,
7411,
7412,
7616,
7617,
7618,
7619,
7620,
7621,
7622,
7623,
7624,
7625,
7626,
7627,
7628,
7629,
7630,
7631,
7632,
7633,
7634,
7635,
7636,
7637,
7638,
7639,
7640,
7641,
7642,
7643,
7644,
7645,
7646,
7647,
7648,
7649,
7650,
7651,
7652,
7653,
7654,
7676,
7677,
7678,
7679,
8204,
8205,
8255,
8256,
8276,
8400,
8401,
8402,
8403,
8404,
8405,
8406,
8407,
8408,
8409,
8410,
8411,
8412,
8417,
8421,
8422,
8423,
8424,
8425,
8426,
8427,
8428,
8429,
8430,
8431,
8432,
11503,
11504,
11505,
11647,
11744,
11745,
11746,
11747,
11748,
11749,
11750,
11751,
11752,
11753,
11754,
11755,
11756,
11757,
11758,
11759,
11760,
11761,
11762,
11763,
11764,
11765,
11766,
11767,
11768,
11769,
11770,
11771,
11772,
11773,
11774,
11775,
12330,
12331,
12332,
12333,
12334,
12335,
12441,
12442,
42528,
42529,
42530,
42531,
42532,
42533,
42534,
42535,
42536,
42537,
42607,
42612,
42613,
42614,
42615,
42616,
42617,
42618,
42619,
42620,
42621,
42655,
42736,
42737,
43010,
43014,
43019,
43043,
43044,
43045,
43046,
43047,
43136,
43137,
43188,
43189,
43190,
43191,
43192,
43193,
43194,
43195,
43196,
43197,
43198,
43199,
43200,
43201,
43202,
43203,
43204,
43216,
43217,
43218,
43219,
43220,
43221,
43222,
43223,
43224,
43225,
43232,
43233,
43234,
43235,
43236,
43237,
43238,
43239,
43240,
43241,
43242,
43243,
43244,
43245,
43246,
43247,
43248,
43249,
43264,
43265,
43266,
43267,
43268,
43269,
43270,
43271,
43272,
43273,
43302,
43303,
43304,
43305,
43306,
43307,
43308,
43309,
43335,
43336,
43337,
43338,
43339,
43340,
43341,
43342,
43343,
43344,
43345,
43346,
43347,
43392,
43393,
43394,
43395,
43443,
43444,
43445,
43446,
43447,
43448,
43449,
43450,
43451,
43452,
43453,
43454,
43455,
43456,
43472,
43473,
43474,
43475,
43476,
43477,
43478,
43479,
43480,
43481,
43561,
43562,
43563,
43564,
43565,
43566,
43567,
43568,
43569,
43570,
43571,
43572,
43573,
43574,
43587,
43596,
43597,
43600,
43601,
43602,
43603,
43604,
43605,
43606,
43607,
43608,
43609,
43643,
43696,
43698,
43699,
43700,
43703,
43704,
43710,
43711,
43713,
43755,
43756,
43757,
43758,
43759,
43765,
43766,
44003,
44004,
44005,
44006,
44007,
44008,
44009,
44010,
44012,
44013,
44016,
44017,
44018,
44019,
44020,
44021,
44022,
44023,
44024,
44025,
64286,
65024,
65025,
65026,
65027,
65028,
65029,
65030,
65031,
65032,
65033,
65034,
65035,
65036,
65037,
65038,
65039,
65056,
65057,
65058,
65059,
65060,
65061,
65062,
65075,
65076,
65101,
65102,
65103,
65296,
65297,
65298,
65299,
65300,
65301,
65302,
65303,
65304,
65305,
65343
];
{
"name": "jshint",
"version": "2.4.2",
"homepage": "http://jshint.com/",
"description": "Static analysis tool for JavaScript",
"name": "jshint",
"version": "2.4.3",
"homepage": "http://jshint.com/",
"description": "Static analysis tool for JavaScript",
"author": {
"name": "Anton Kovalyov",
"email": "anton@kovalyov.net",
"url": "http://anton.kovalyov.net/"
},
"author": {
"name": "Anton Kovalyov",
"email": "anton@kovalyov.net",
"url": "http://anton.kovalyov.net/"
},
"repository": {
"type": "git",
"url": "https://github.com/jshint/jshint.git"
},
"repository": {
"type": "git",
"url": "https://github.com/jshint/jshint.git"
},
"bugs": {
"url": "https://github.com/jshint/jshint/issues"
},
"bugs": {
"url": "https://github.com/jshint/jshint/issues"
},
"bin": {
"jshint": "./bin/jshint"
},
"bin": {
"jshint": "./bin/jshint"
},
"scripts": {
"data": "node scripts/generate-identifier-data",
"build": "node bin/build",
"test": "nodeunit tests tests/regression tests/unit",
"pretest": "jshint src"
},
"scripts": {
"data": "node scripts/generate-identifier-data",
"build": "node bin/build",
"test": "nodeunit tests tests/regression tests/unit",
"pretest": "jshint src"
},
"main": "./src/jshint.js",
"main": "./src/jshint.js",
"dependencies": {
"shelljs": "0.1.x",
"underscore": "1.4.x",
"cli": "0.4.x",
"minimatch": "0.x.x",
"htmlparser2": "3.3.x",
"console-browserify": "0.1.x"
},
"dependencies": {
"shelljs": "0.1.x",
"underscore": "1.4.x",
"cli": "0.4.x",
"minimatch": "0.x.x",
"htmlparser2": "3.3.x",
"console-browserify": "0.1.x"
},
"devDependencies": {
"jshint": "2.4.x",
"shelljs": "0.1.x",
"browserify": "3.x",
"coveraje": "0.2.x",
"nodeunit": "0.8.x",
"sinon": "1.7.x",
"unicode-6.3.0": "0.1.x",
"regenerate": "0.5.x"
},
"devDependencies": {
"jshint": "2.4.x",
"shelljs": "0.1.x",
"browserify": "3.x",
"coveraje": "0.2.x",
"nodeunit": "0.8.x",
"sinon": "1.7.x",
"unicode-6.3.0": "0.1.x",
"regenerate": "0.5.x"
},
"jshintConfig": {
"boss": true,
"node": true,
"strict": true,
"white": true,
"smarttabs": true,
"maxlen": 100,
"newcap": false,
"undef": true,
"unused": true,
"onecase": true,
"indent": 2
},
"jshintConfig": {
"boss": true,
"node": true,
"strict": true,
"white": true,
"smarttabs": true,
"maxlen": 100,
"newcap": false,
"undef": true,
"unused": true,
"onecase": true,
"indent": 2
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/jshint/jshint/blob/master/LICENSE"
}
],
"licenses": [
{
"type": "MIT",
"url": "https://github.com/jshint/jshint/blob/master/LICENSE"
}
],
"preferGlobal": true,
"preferGlobal": true,
"files": [
"bin",
"src",
"data"
]
"files": [
"bin",
"src",
"data"
]
}

@@ -13,29 +13,29 @@ "use strict";

var OPTIONS = {
"config": ["c", "Custom configuration file", "string", false ],
"reporter": ["reporter", "Custom reporter (<PATH>|jslint|checkstyle)", "string", undefined ],
"exclude": ["exclude",
"Exclude files matching the given filename pattern (same as .jshintignore)", "string", null],
"exclude-path": ["exclude-path", "Pass in a custom jshintignore file path", "string", null],
"verbose": ["verbose", "Show message codes"],
"show-non-errors": ["show-non-errors", "Show additional data generated by jshint"],
"extra-ext": ["e",
"Comma-separated list of file extensions to use (default is .js)", "string", ""],
"config": ["c", "Custom configuration file", "string", false ],
"reporter": ["reporter", "Custom reporter (<PATH>|jslint|checkstyle)", "string", undefined ],
"exclude": ["exclude",
"Exclude files matching the given filename pattern (same as .jshintignore)", "string", null],
"exclude-path": ["exclude-path", "Pass in a custom jshintignore file path", "string", null],
"verbose": ["verbose", "Show message codes"],
"show-non-errors": ["show-non-errors", "Show additional data generated by jshint"],
"extra-ext": ["e",
"Comma-separated list of file extensions to use (default is .js)", "string", ""],
"extract": [
"extract",
"Extract inline scripts contained in HTML (auto|always|never, default to never)",
"string",
"never"
],
"extract": [
"extract",
"Extract inline scripts contained in HTML (auto|always|never, default to never)",
"string",
"never"
],
// Deprecated options.
"jslint-reporter": [
"jslint-reporter",
deprecated("Use a jslint compatible reporter", "--reporter=jslint")
],
// Deprecated options.
"jslint-reporter": [
"jslint-reporter",
deprecated("Use a jslint compatible reporter", "--reporter=jslint")
],
"checkstyle-reporter": [
"checkstyle-reporter",
deprecated("Use a CheckStyle compatible XML reporter", "--reporter=checkstyle")
]
"checkstyle-reporter": [
"checkstyle-reporter",
deprecated("Use a CheckStyle compatible XML reporter", "--reporter=checkstyle")
]
};

@@ -49,3 +49,3 @@

* @param {string} alt (optional) Alternative command to include in the
* deprecation notice.
* deprecation notice.
*

@@ -55,7 +55,7 @@ * @returns {string}

function deprecated(text, alt) {
if (!alt) {
return text + " (DEPRECATED)";
}
if (!alt) {
return text + " (DEPRECATED)";
}
return text + " (DEPRECATED, use " + alt + " instead)";
return text + " (DEPRECATED, use " + alt + " instead)";
}

@@ -78,8 +78,8 @@

function removeComments(str) {
str = str || "";
str = str || "";
str = str.replace(/\/\*(?:(?!\*\/)[\s\S])*\*\//g, "");
str = str.replace(/\/\/[^\n\r]*/g, ""); // Everything after '//'
str = str.replace(/\/\*(?:(?!\*\/)[\s\S])*\*\//g, "");
str = str.replace(/\/\/[^\n\r]*/g, ""); // Everything after '//'
return str;
return str;
}

@@ -96,14 +96,14 @@

function findConfig(file) {
var dir = path.dirname(path.resolve(file));
var envs = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
var home = path.normalize(path.join(envs, ".jshintrc"));
var dir = path.dirname(path.resolve(file));
var envs = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
var home = path.normalize(path.join(envs, ".jshintrc"));
var proj = findFile(".jshintrc", dir);
if (proj)
return proj;
var proj = findFile(".jshintrc", dir);
if (proj)
return proj;
if (shjs.test("-e", home))
return home;
if (shjs.test("-e", home))
return home;
return null;
return null;
}

@@ -120,13 +120,13 @@

function loadNpmConfig(file) {
var dir = path.dirname(path.resolve(file));
var fp = findFile("package.json", dir);
var dir = path.dirname(path.resolve(file));
var fp = findFile("package.json", dir);
if (!fp)
return null;
if (!fp)
return null;
try {
return require(fp).jshintConfig;
} catch (e) {
return null;
}
try {
return require(fp).jshintConfig;
} catch (e) {
return null;
}
}

@@ -139,10 +139,10 @@

* @returns {object} imported module for the reporter or 'null'
* if a module cannot be imported.
* if a module cannot be imported.
*/
function loadReporter(fp) {
try {
return require(fp).reporter;
} catch (err) {
return null;
}
try {
return require(fp).reporter;
} catch (err) {
return null;
}
}

@@ -162,3 +162,3 @@

* @param {string} dir directory to start search from (default:
* current working directory)
* current working directory)
*

@@ -168,22 +168,22 @@ * @returns {string} normalized filename

function findFile(name, dir) {
dir = dir || process.cwd();
dir = dir || process.cwd();
var filename = path.normalize(path.join(dir, name));
if (findFileResults[filename] !== undefined) {
return findFileResults[filename];
}
var filename = path.normalize(path.join(dir, name));
if (findFileResults[filename] !== undefined) {
return findFileResults[filename];
}
var parent = path.resolve(dir, "../");
var parent = path.resolve(dir, "../");
if (shjs.test("-e", filename)) {
findFileResults[filename] = filename;
return filename;
}
if (shjs.test("-e", filename)) {
findFileResults[filename] = filename;
return filename;
}
if (dir === parent) {
findFileResults[filename] = null;
return null;
}
if (dir === parent) {
findFileResults[filename] = null;
return null;
}
return findFile(name, parent);
return findFile(name, parent);
}

@@ -198,21 +198,21 @@

function loadIgnores(exclude, excludePath) {
var file = findFile(excludePath || ".jshintignore");
var file = findFile(excludePath || ".jshintignore");
if (!file && !exclude) {
return [];
}
if (!file && !exclude) {
return [];
}
var lines = (file ? shjs.cat(file) : "").split("\n");
lines.unshift(exclude || "");
var lines = (file ? shjs.cat(file) : "").split("\n");
lines.unshift(exclude || "");
return lines
.filter(function (line) {
return !!line.trim();
})
.map(function (line) {
if (line[0] === "!")
return "!" + path.resolve(path.dirname(file), line.substr(1).trim());
return lines
.filter(function (line) {
return !!line.trim();
})
.map(function (line) {
if (line[0] === "!")
return "!" + path.resolve(path.dirname(file), line.substr(1).trim());
return path.resolve(path.dirname(file), line.trim());
});
return path.join(path.dirname(file), line.trim());
});
}

@@ -229,16 +229,16 @@

function isIgnored(fp, patterns) {
return patterns.some(function (ip) {
if (minimatch(path.resolve(fp), ip, { nocase: true })) {
return true;
}
return patterns.some(function (ip) {
if (minimatch(path.resolve(fp), ip, { nocase: true })) {
return true;
}
if (path.resolve(fp) === ip) {
return true;
}
if (path.resolve(fp) === ip) {
return true;
}
if (shjs.test("-d", fp) && ip.match(/^[^\/]*\/?$/) &&
fp.match(new RegExp("^" + ip + ".*"))) {
return true;
}
});
if (shjs.test("-d", fp) && ip.match(/^[^\/]*\/?$/) &&
fp.match(new RegExp("^" + ip + ".*"))) {
return true;
}
});
}

@@ -259,43 +259,43 @@

function extract(code, when) {
// A JS file won't start with a less-than character, whereas a HTML file
// should always start with that.
if (when !== "always" && (when !== "auto" || !/^\s*</.test(code)))
return code;
// A JS file won't start with a less-than character, whereas a HTML file
// should always start with that.
if (when !== "always" && (when !== "auto" || !/^\s*</.test(code)))
return code;
var inscript = false;
var index = 0;
var js = [];
var inscript = false;
var index = 0;
var js = [];
// Test if current tag is a valid <script> tag.
function onopen(name, attrs) {
if (name !== "script")
return;
// Test if current tag is a valid <script> tag.
function onopen(name, attrs) {
if (name !== "script")
return;
if (attrs.type && !/text\/javascript/.test(attrs.type.toLowerCase()))
return;
if (attrs.type && !/text\/javascript/.test(attrs.type.toLowerCase()))
return;
// Mark that we're inside a <script> a tag and push all new lines
// in between the last </script> tag and this <script> tag to preserve
// location information.
inscript = true;
js.push.apply(js, code.slice(index, parser.endIndex).match(/\n\r|\n|\r/g));
}
// Mark that we're inside a <script> a tag and push all new lines
// in between the last </script> tag and this <script> tag to preserve
// location information.
inscript = true;
js.push.apply(js, code.slice(index, parser.endIndex).match(/\n\r|\n|\r/g));
}
function onclose(name) {
if (name !== "script" || !inscript)
return;
function onclose(name) {
if (name !== "script" || !inscript)
return;
inscript = false;
index = parser.startIndex;
}
inscript = false;
index = parser.startIndex;
}
function ontext(data) {
if (inscript)
js.push(data); // Collect JavaScript code.
}
function ontext(data) {
if (inscript)
js.push(data); // Collect JavaScript code.
}
var parser = new htmlparser.Parser({ onopentag: onopen, onclosetag: onclose, ontext: ontext });
parser.parseComplete(code);
var parser = new htmlparser.Parser({ onopentag: onopen, onclosetag: onclose, ontext: ontext });
parser.parseComplete(code);
return js.join("");
return js.join("");
}

@@ -313,23 +313,23 @@

function collect(fp, files, ignores, ext) {
if (ignores && isIgnored(fp, ignores)) {
return;
}
if (ignores && isIgnored(fp, ignores)) {
return;
}
if (!shjs.test("-e", fp)) {
cli.error("Can't open " + fp);
return;
}
if (!shjs.test("-e", fp)) {
cli.error("Can't open " + fp);
return;
}
if (shjs.test("-d", fp)) {
shjs.ls(fp).forEach(function (item) {
var itempath = path.join(fp, item);
if (shjs.test("-d", itempath) || item.match(ext)) {
collect(itempath, files, ignores, ext);
}
});
if (shjs.test("-d", fp)) {
shjs.ls(fp).forEach(function (item) {
var itempath = path.join(fp, item);
if (shjs.test("-d", itempath) || item.match(ext)) {
collect(itempath, files, ignores, ext);
}
});
return;
}
return;
}
files.push(fp);
files.push(fp);
}

@@ -347,253 +347,253 @@

function lint(code, results, config, data, file) {
var globals;
var lintData;
var buffer = [];
var globals;
var lintData;
var buffer = [];
config = config || {};
config = JSON.parse(JSON.stringify(config));
config = config || {};
config = JSON.parse(JSON.stringify(config));
if (config.prereq) {
config.prereq.forEach(function (fp) {
fp = path.join(config.dirname, fp);
if (shjs.test("-e", fp))
buffer.push(shjs.cat(fp));
});
delete config.prereq;
}
if (config.prereq) {
config.prereq.forEach(function (fp) {
fp = path.join(config.dirname, fp);
if (shjs.test("-e", fp))
buffer.push(shjs.cat(fp));
});
delete config.prereq;
}
if (config.globals) {
globals = config.globals;
delete config.globals;
}
if (config.globals) {
globals = config.globals;
delete config.globals;
}
delete config.dirname;
buffer.push(code);
buffer = buffer.join("\n");
buffer = buffer.replace(/^\uFEFF/, ""); // Remove potential Unicode BOM.
delete config.dirname;
buffer.push(code);
buffer = buffer.join("\n");
buffer = buffer.replace(/^\uFEFF/, ""); // Remove potential Unicode BOM.
if (!JSHINT(buffer, config, globals)) {
JSHINT.errors.forEach(function (err) {
if (err) {
results.push({ file: file || "stdin", error: err });
}
});
}
if (!JSHINT(buffer, config, globals)) {
JSHINT.errors.forEach(function (err) {
if (err) {
results.push({ file: file || "stdin", error: err });
}
});
}
lintData = JSHINT.data();
lintData = JSHINT.data();
if (lintData) {
lintData.file = file || "stdin";
data.push(lintData);
}
if (lintData) {
lintData.file = file || "stdin";
data.push(lintData);
}
}
var exports = {
extract: extract,
extract: extract,
/**
* Loads and parses a configuration file.
*
* @param {string} fp a path to the config file
* @returns {object} config object
*/
loadConfig: function (fp) {
if (!fp) {
return {};
}
/**
* Loads and parses a configuration file.
*
* @param {string} fp a path to the config file
* @returns {object} config object
*/
loadConfig: function (fp) {
if (!fp) {
return {};
}
if (!shjs.test("-e", fp)) {
cli.error("Can't find config file: " + fp);
process.exit(1);
}
if (!shjs.test("-e", fp)) {
cli.error("Can't find config file: " + fp);
process.exit(1);
}
try {
var config = JSON.parse(removeComments(shjs.cat(fp)));
config.dirname = path.dirname(fp);
try {
var config = JSON.parse(removeComments(shjs.cat(fp)));
config.dirname = path.dirname(fp);
if (config['extends']) {
_.defaults(config, exports.loadConfig(path.resolve(config.dirname, config['extends'])));
delete config['extends'];
}
if (config['extends']) {
_.defaults(config, exports.loadConfig(path.resolve(config.dirname, config['extends'])));
delete config['extends'];
}
return config;
} catch (err) {
cli.error("Can't parse config file: " + fp);
process.exit(1);
}
},
return config;
} catch (err) {
cli.error("Can't parse config file: " + fp);
process.exit(1);
}
},
/**
* Gathers all files that need to be linted
*
* @param {object} post-processed options from 'interpret':
* args - CLI arguments
* ignores - A list of files/dirs to ignore (defaults to .jshintignores)
* extensions - A list of non-dot-js extensions to check
*/
gather: function (opts) {
var files = [];
/**
* Gathers all files that need to be linted
*
* @param {object} post-processed options from 'interpret':
* args - CLI arguments
* ignores - A list of files/dirs to ignore (defaults to .jshintignores)
* extensions - A list of non-dot-js extensions to check
*/
gather: function (opts) {
var files = [];
var reg = new RegExp("\\.(js" +
(!opts.extensions ? "" : "|" +
opts.extensions.replace(/,/g, "|").replace(/[\. ]/g, "")) + ")$");
var reg = new RegExp("\\.(js" +
(!opts.extensions ? "" : "|" +
opts.extensions.replace(/,/g, "|").replace(/[\. ]/g, "")) + ")$");
var ignores = !opts.ignores ? loadIgnores() : opts.ignores.map(function (target) {
return path.resolve(target);
});
var ignores = !opts.ignores ? loadIgnores() : opts.ignores.map(function (target) {
return path.resolve(target);
});
opts.args.forEach(function (target) {
collect(target, files, ignores, reg);
});
opts.args.forEach(function (target) {
collect(target, files, ignores, reg);
});
return files;
},
return files;
},
/**
* Gathers all files that need to be linted, lints them, sends them to
* a reporter and returns the overall result.
*
* @param {object} post-processed options from 'interpret':
* args - CLI arguments
* config - Configuration object
* reporter - Reporter function
* ignores - A list of files/dirs to ignore
* extensions - A list of non-dot-js extensions to check
* @param {function} cb a callback to call when function is finished
* asynchronously.
*
* @returns {bool} 'true' if all files passed, 'false' otherwise and 'null'
* when function will be finished asynchronously.
*/
run: function (opts, cb) {
var files = exports.gather(opts);
var results = [];
var data = [];
/**
* Gathers all files that need to be linted, lints them, sends them to
* a reporter and returns the overall result.
*
* @param {object} post-processed options from 'interpret':
* args - CLI arguments
* config - Configuration object
* reporter - Reporter function
* ignores - A list of files/dirs to ignore
* extensions - A list of non-dot-js extensions to check
* @param {function} cb a callback to call when function is finished
* asynchronously.
*
* @returns {bool} 'true' if all files passed, 'false' otherwise and 'null'
* when function will be finished asynchronously.
*/
run: function (opts, cb) {
var files = exports.gather(opts);
var results = [];
var data = [];
if (opts.useStdin) {
cli.withStdin(function (code) {
lint(extract(code, opts.extract), results, opts.config || {}, data);
(opts.reporter || defReporter)(results, data, { verbose: opts.verbose });
cb(results.length === 0);
});
if (opts.useStdin) {
cli.withStdin(function (code) {
lint(extract(code, opts.extract), results, opts.config || {}, data);
(opts.reporter || defReporter)(results, data, { verbose: opts.verbose });
cb(results.length === 0);
});
return null;
}
return null;
}
files.forEach(function (file) {
var config = opts.config || loadNpmConfig(file) || exports.loadConfig(findConfig(file));
var code;
files.forEach(function (file) {
var config = opts.config || loadNpmConfig(file) || exports.loadConfig(findConfig(file));
var code;
try {
code = shjs.cat(file);
} catch (err) {
cli.error("Can't open " + file);
process.exit(1);
}
try {
code = shjs.cat(file);
} catch (err) {
cli.error("Can't open " + file);
process.exit(1);
}
lint(extract(code, opts.extract), results, config, data, file);
});
lint(extract(code, opts.extract), results, config, data, file);
});
(opts.reporter || defReporter)(results, data, { verbose: opts.verbose });
return results.length === 0;
},
(opts.reporter || defReporter)(results, data, { verbose: opts.verbose });
return results.length === 0;
},
/**
* Helper exposed for testing.
* Used to determine is stdout has any buffered output before exiting the program
*/
getBufferSize: function () {
return process.stdout.bufferSize;
},
/**
* Helper exposed for testing.
* Used to determine is stdout has any buffered output before exiting the program
*/
getBufferSize: function () {
return process.stdout.bufferSize;
},
/**
* Main entrance function. Parses arguments and calls 'run' when
* its done. This function is called from bin/jshint file.
*
* @param {object} args, arguments in the process.argv format.
*/
interpret: function (args) {
cli.setArgv(args);
cli.options = {};
/**
* Main entrance function. Parses arguments and calls 'run' when
* its done. This function is called from bin/jshint file.
*
* @param {object} args, arguments in the process.argv format.
*/
interpret: function (args) {
cli.setArgv(args);
cli.options = {};
cli.enable("version", "glob", "help");
cli.setApp(path.resolve(__dirname + "/../package.json"));
cli.enable("version", "glob", "help");
cli.setApp(path.resolve(__dirname + "/../package.json"));
var options = cli.parse(OPTIONS);
// Use config file if specified
var config;
if (options.config) {
config = exports.loadConfig(options.config);
}
var options = cli.parse(OPTIONS);
// Use config file if specified
var config;
if (options.config) {
config = exports.loadConfig(options.config);
}
switch (true) {
// JSLint reporter
case options.reporter === "jslint":
case options["jslint-reporter"]:
options.reporter = "./reporters/jslint_xml.js";
break;
switch (true) {
// JSLint reporter
case options.reporter === "jslint":
case options["jslint-reporter"]:
options.reporter = "./reporters/jslint_xml.js";
break;
// CheckStyle (XML) reporter
case options.reporter === "checkstyle":
case options["checkstyle-reporter"]:
options.reporter = "./reporters/checkstyle.js";
break;
// CheckStyle (XML) reporter
case options.reporter === "checkstyle":
case options["checkstyle-reporter"]:
options.reporter = "./reporters/checkstyle.js";
break;
// Reporter that displays additional JSHint data
case options["show-non-errors"]:
options.reporter = "./reporters/non_error.js";
break;
// Reporter that displays additional JSHint data
case options["show-non-errors"]:
options.reporter = "./reporters/non_error.js";
break;
// Custom reporter
case options.reporter !== undefined:
options.reporter = path.resolve(process.cwd(), options.reporter);
}
// Custom reporter
case options.reporter !== undefined:
options.reporter = path.resolve(process.cwd(), options.reporter);
}
var reporter;
if (options.reporter) {
reporter = loadReporter(options.reporter);
var reporter;
if (options.reporter) {
reporter = loadReporter(options.reporter);
if (reporter === null) {
cli.error("Can't load reporter file: " + options.reporter);
process.exit(1);
}
}
if (reporter === null) {
cli.error("Can't load reporter file: " + options.reporter);
process.exit(1);
}
}
// This is a hack. exports.run is both sync and async function
// because I needed stdin support (and cli.withStdin is async)
// and was too lazy to change tests.
// This is a hack. exports.run is both sync and async function
// because I needed stdin support (and cli.withStdin is async)
// and was too lazy to change tests.
function done(passed) {
/*jshint eqnull:true */
function done(passed) {
/*jshint eqnull:true */
if (passed == null)
return;
if (passed == null)
return;
// Patch as per https://github.com/visionmedia/mocha/issues/333
// fixes issues with piped output on Windows.
// Root issue is here https://github.com/joyent/node/issues/3584
function exit() { process.exit(passed ? 0 : 2); }
try {
if (exports.getBufferSize()) {
process.stdout.once('drain', exit);
} else {
exit();
}
} catch (err) {
exit();
}
}
// Patch as per https://github.com/visionmedia/mocha/issues/333
// fixes issues with piped output on Windows.
// Root issue is here https://github.com/joyent/node/issues/3584
function exit() { process.exit(passed ? 0 : 2); }
try {
if (exports.getBufferSize()) {
process.stdout.once('drain', exit);
} else {
exit();
}
} catch (err) {
exit();
}
}
done(exports.run({
args: cli.args,
config: config,
reporter: reporter,
ignores: loadIgnores(options.exclude, options["exclude-path"]),
extensions: options["extra-ext"],
verbose: options.verbose,
extract: options.extract,
useStdin: {"-": true, "/dev/stdin": true}[args[args.length - 1]]
}, done));
}
done(exports.run({
args: cli.args,
config: config,
reporter: reporter,
ignores: loadIgnores(options.exclude, options["exclude-path"]),
extensions: options["extra-ext"],
verbose: options.verbose,
extract: options.extract,
useStdin: {"-": true, "/dev/stdin": true}[args[args.length - 1]]
}, done));
}
};
module.exports = exports;

@@ -23,11 +23,11 @@ /*

var Token = {
Identifier: 1,
Punctuator: 2,
NumericLiteral: 3,
StringLiteral: 4,
Comment: 5,
Keyword: 6,
NullLiteral: 7,
BooleanLiteral: 8,
RegExp: 9
Identifier: 1,
Punctuator: 2,
NumericLiteral: 3,
StringLiteral: 4,
Comment: 5,
Keyword: 6,
NullLiteral: 7,
BooleanLiteral: 8,
RegExp: 9
};

@@ -39,17 +39,17 @@

function asyncTrigger() {
var _checks = [];
var _checks = [];
return {
push: function (fn) {
_checks.push(fn);
},
return {
push: function (fn) {
_checks.push(fn);
},
check: function () {
for (var check = 0; check < _checks.length; ++check) {
_checks[check]();
}
check: function () {
for (var check = 0; check < _checks.length; ++check) {
_checks[check]();
}
_checks.splice(0, _checks.length);
}
};
_checks.splice(0, _checks.length);
}
};
}

@@ -84,1513 +84,1534 @@

function Lexer(source) {
var lines = source;
var lines = source;
if (typeof lines === "string") {
lines = lines
.replace(/\r\n/g, "\n")
.replace(/\r/g, "\n")
.split("\n");
}
if (typeof lines === "string") {
lines = lines
.replace(/\r\n/g, "\n")
.replace(/\r/g, "\n")
.split("\n");
}
// If the first line is a shebang (#!), make it a blank and move on.
// Shebangs are used by Node scripts.
// If the first line is a shebang (#!), make it a blank and move on.
// Shebangs are used by Node scripts.
if (lines[0] && lines[0].substr(0, 2) === "#!") {
if (lines[0].indexOf("node") !== -1) {
state.option.node = true;
}
lines[0] = "";
}
if (lines[0] && lines[0].substr(0, 2) === "#!") {
if (lines[0].indexOf("node") !== -1) {
state.option.node = true;
}
lines[0] = "";
}
this.emitter = new events.EventEmitter();
this.source = source;
this.setLines(lines);
this.prereg = true;
this.emitter = new events.EventEmitter();
this.source = source;
this.setLines(lines);
this.prereg = true;
this.line = 0;
this.char = 1;
this.from = 1;
this.input = "";
this.inComment = false;
this.line = 0;
this.char = 1;
this.from = 1;
this.input = "";
this.inComment = false;
for (var i = 0; i < state.option.indent; i += 1) {
state.tab += " ";
}
for (var i = 0; i < state.option.indent; i += 1) {
state.tab += " ";
}
}
Lexer.prototype = {
_lines: [],
_lines: [],
getLines: function () {
this._lines = state.lines;
return this._lines;
},
getLines: function () {
this._lines = state.lines;
return this._lines;
},
setLines: function (val) {
this._lines = val;
state.lines = this._lines;
},
setLines: function (val) {
this._lines = val;
state.lines = this._lines;
},
/*
* Return the next i character without actually moving the
* char pointer.
*/
peek: function (i) {
return this.input.charAt(i || 0);
},
/*
* Return the next i character without actually moving the
* char pointer.
*/
peek: function (i) {
return this.input.charAt(i || 0);
},
/*
* Move the char pointer forward i times.
*/
skip: function (i) {
i = i || 1;
this.char += i;
this.input = this.input.slice(i);
},
/*
* Move the char pointer forward i times.
*/
skip: function (i) {
i = i || 1;
this.char += i;
this.input = this.input.slice(i);
},
/*
* Subscribe to a token event. The API for this method is similar
* Underscore.js i.e. you can subscribe to multiple events with
* one call:
*
* lex.on("Identifier Number", function (data) {
* // ...
* });
*/
on: function (names, listener) {
names.split(" ").forEach(function (name) {
this.emitter.on(name, listener);
}.bind(this));
},
/*
* Subscribe to a token event. The API for this method is similar
* Underscore.js i.e. you can subscribe to multiple events with
* one call:
*
* lex.on("Identifier Number", function (data) {
* // ...
* });
*/
on: function (names, listener) {
names.split(" ").forEach(function (name) {
this.emitter.on(name, listener);
}.bind(this));
},
/*
* Trigger a token event. All arguments will be passed to each
* listener.
*/
trigger: function () {
this.emitter.emit.apply(this.emitter, Array.prototype.slice.call(arguments));
},
/*
* Trigger a token event. All arguments will be passed to each
* listener.
*/
trigger: function () {
this.emitter.emit.apply(this.emitter, Array.prototype.slice.call(arguments));
},
/*
* Postpone a token event. the checking condition is set as
* last parameter, and the trigger function is called in a
* stored callback. To be later called using the check() function
* by the parser. This avoids parser's peek() to give the lexer
* a false context.
*/
triggerAsync: function (type, args, checks, fn) {
checks.push(function () {
if (fn()) {
this.trigger(type, args);
}
}.bind(this));
},
/*
* Postpone a token event. the checking condition is set as
* last parameter, and the trigger function is called in a
* stored callback. To be later called using the check() function
* by the parser. This avoids parser's peek() to give the lexer
* a false context.
*/
triggerAsync: function (type, args, checks, fn) {
checks.push(function () {
if (fn()) {
this.trigger(type, args);
}
}.bind(this));
},
/*
* Extract a punctuator out of the next sequence of characters
* or return 'null' if its not possible.
*
* This method's implementation was heavily influenced by the
* scanPunctuator function in the Esprima parser's source code.
*/
scanPunctuator: function () {
var ch1 = this.peek();
var ch2, ch3, ch4;
/*
* Extract a punctuator out of the next sequence of characters
* or return 'null' if its not possible.
*
* This method's implementation was heavily influenced by the
* scanPunctuator function in the Esprima parser's source code.
*/
scanPunctuator: function () {
var ch1 = this.peek();
var ch2, ch3, ch4;
switch (ch1) {
// Most common single-character punctuators
case ".":
if ((/^[0-9]$/).test(this.peek(1))) {
return null;
}
if (this.peek(1) === "." && this.peek(2) === ".") {
return {
type: Token.Punctuator,
value: "..."
};
}
/* falls through */
case "(":
case ")":
case ";":
case ",":
case "{":
case "}":
case "[":
case "]":
case ":":
case "~":
case "?":
return {
type: Token.Punctuator,
value: ch1
};
switch (ch1) {
// Most common single-character punctuators
case ".":
if ((/^[0-9]$/).test(this.peek(1))) {
return null;
}
if (this.peek(1) === "." && this.peek(2) === ".") {
return {
type: Token.Punctuator,
value: "..."
};
}
/* falls through */
case "(":
case ")":
case ";":
case ",":
case "{":
case "}":
case "[":
case "]":
case ":":
case "~":
case "?":
return {
type: Token.Punctuator,
value: ch1
};
// A pound sign (for Node shebangs)
case "#":
return {
type: Token.Punctuator,
value: ch1
};
// A pound sign (for Node shebangs)
case "#":
return {
type: Token.Punctuator,
value: ch1
};
// We're at the end of input
case "":
return null;
}
// We're at the end of input
case "":
return null;
}
// Peek more characters
// Peek more characters
ch2 = this.peek(1);
ch3 = this.peek(2);
ch4 = this.peek(3);
ch2 = this.peek(1);
ch3 = this.peek(2);
ch4 = this.peek(3);
// 4-character punctuator: >>>=
// 4-character punctuator: >>>=
if (ch1 === ">" && ch2 === ">" && ch3 === ">" && ch4 === "=") {
return {
type: Token.Punctuator,
value: ">>>="
};
}
if (ch1 === ">" && ch2 === ">" && ch3 === ">" && ch4 === "=") {
return {
type: Token.Punctuator,
value: ">>>="
};
}
// 3-character punctuators: === !== >>> <<= >>=
// 3-character punctuators: === !== >>> <<= >>=
if (ch1 === "=" && ch2 === "=" && ch3 === "=") {
return {
type: Token.Punctuator,
value: "==="
};
}
if (ch1 === "=" && ch2 === "=" && ch3 === "=") {
return {
type: Token.Punctuator,
value: "==="
};
}
if (ch1 === "!" && ch2 === "=" && ch3 === "=") {
return {
type: Token.Punctuator,
value: "!=="
};
}
if (ch1 === "!" && ch2 === "=" && ch3 === "=") {
return {
type: Token.Punctuator,
value: "!=="
};
}
if (ch1 === ">" && ch2 === ">" && ch3 === ">") {
return {
type: Token.Punctuator,
value: ">>>"
};
}
if (ch1 === ">" && ch2 === ">" && ch3 === ">") {
return {
type: Token.Punctuator,
value: ">>>"
};
}
if (ch1 === "<" && ch2 === "<" && ch3 === "=") {
return {
type: Token.Punctuator,
value: "<<="
};
}
if (ch1 === "<" && ch2 === "<" && ch3 === "=") {
return {
type: Token.Punctuator,
value: "<<="
};
}
if (ch1 === ">" && ch2 === ">" && ch3 === "=") {
return {
type: Token.Punctuator,
value: ">>="
};
}
if (ch1 === ">" && ch2 === ">" && ch3 === "=") {
return {
type: Token.Punctuator,
value: ">>="
};
}
// Fat arrow punctuator
if (ch1 === "=" && ch2 === ">") {
return {
type: Token.Punctuator,
value: ch1 + ch2
};
}
// Fat arrow punctuator
if (ch1 === "=" && ch2 === ">") {
return {
type: Token.Punctuator,
value: ch1 + ch2
};
}
// 2-character punctuators: <= >= == != ++ -- << >> && ||
// += -= *= %= &= |= ^= (but not /=, see below)
if (ch1 === ch2 && ("+-<>&|".indexOf(ch1) >= 0)) {
return {
type: Token.Punctuator,
value: ch1 + ch2
};
}
// 2-character punctuators: <= >= == != ++ -- << >> && ||
// += -= *= %= &= |= ^= (but not /=, see below)
if (ch1 === ch2 && ("+-<>&|".indexOf(ch1) >= 0)) {
return {
type: Token.Punctuator,
value: ch1 + ch2
};
}
if ("<>=!+-*%&|^".indexOf(ch1) >= 0) {
if (ch2 === "=") {
return {
type: Token.Punctuator,
value: ch1 + ch2
};
}
if ("<>=!+-*%&|^".indexOf(ch1) >= 0) {
if (ch2 === "=") {
return {
type: Token.Punctuator,
value: ch1 + ch2
};
}
return {
type: Token.Punctuator,
value: ch1
};
}
return {
type: Token.Punctuator,
value: ch1
};
}
// Special case: /=. We need to make sure that this is an
// operator and not a regular expression.
// Special case: /=. We need to make sure that this is an
// operator and not a regular expression.
if (ch1 === "/") {
if (ch2 === "=" && /\/=(?!(\S*\/[gim]?))/.test(this.input)) {
// /= is not a part of a regular expression, return it as a
// punctuator.
return {
type: Token.Punctuator,
value: "/="
};
}
if (ch1 === "/") {
if (ch2 === "=" && /\/=(?!(\S*\/[gim]?))/.test(this.input)) {
// /= is not a part of a regular expression, return it as a
// punctuator.
return {
type: Token.Punctuator,
value: "/="
};
}
return {
type: Token.Punctuator,
value: "/"
};
}
return {
type: Token.Punctuator,
value: "/"
};
}
return null;
},
return null;
},
/*
* Extract a comment out of the next sequence of characters and/or
* lines or return 'null' if its not possible. Since comments can
* span across multiple lines this method has to move the char
* pointer.
*
* In addition to normal JavaScript comments (// and /*) this method
* also recognizes JSHint- and JSLint-specific comments such as
* /*jshint, /*jslint, /*globals and so on.
*/
scanComments: function () {
var ch1 = this.peek();
var ch2 = this.peek(1);
var rest = this.input.substr(2);
var startLine = this.line;
var startChar = this.char;
/*
* Extract a comment out of the next sequence of characters and/or
* lines or return 'null' if its not possible. Since comments can
* span across multiple lines this method has to move the char
* pointer.
*
* In addition to normal JavaScript comments (// and /*) this method
* also recognizes JSHint- and JSLint-specific comments such as
* /*jshint, /*jslint, /*globals and so on.
*/
scanComments: function () {
var ch1 = this.peek();
var ch2 = this.peek(1);
var rest = this.input.substr(2);
var startLine = this.line;
var startChar = this.char;
// Create a comment token object and make sure it
// has all the data JSHint needs to work with special
// comments.
// Create a comment token object and make sure it
// has all the data JSHint needs to work with special
// comments.
function commentToken(label, body, opt) {
var special = ["jshint", "jslint", "members", "member", "globals", "global", "exported"];
var isSpecial = false;
var value = label + body;
var commentType = "plain";
opt = opt || {};
function commentToken(label, body, opt) {
var special = ["jshint", "jslint", "members", "member", "globals", "global", "exported"];
var isSpecial = false;
var value = label + body;
var commentType = "plain";
opt = opt || {};
if (opt.isMultiline) {
value += "*/";
}
if (opt.isMultiline) {
value += "*/";
}
special.forEach(function (str) {
if (isSpecial) {
return;
}
special.forEach(function (str) {
if (isSpecial) {
return;
}
// Don't recognize any special comments other than jshint for single-line
// comments. This introduced many problems with legit comments.
if (label === "//" && str !== "jshint") {
return;
}
// Don't recognize any special comments other than jshint for single-line
// comments. This introduced many problems with legit comments.
if (label === "//" && str !== "jshint") {
return;
}
if (body.substr(0, str.length) === str) {
isSpecial = true;
label = label + str;
body = body.substr(str.length);
}
if (body.substr(0, str.length) === str) {
isSpecial = true;
label = label + str;
body = body.substr(str.length);
}
if (!isSpecial && body.charAt(0) === " " && body.substr(1, str.length) === str) {
isSpecial = true;
label = label + " " + str;
body = body.substr(str.length + 1);
}
if (!isSpecial && body.charAt(0) === " " && body.substr(1, str.length) === str) {
isSpecial = true;
label = label + " " + str;
body = body.substr(str.length + 1);
}
if (!isSpecial) {
return;
}
if (!isSpecial) {
return;
}
switch (str) {
case "member":
commentType = "members";
break;
case "global":
commentType = "globals";
break;
default:
commentType = str;
}
});
switch (str) {
case "member":
commentType = "members";
break;
case "global":
commentType = "globals";
break;
default:
commentType = str;
}
});
return {
type: Token.Comment,
commentType: commentType,
value: value,
body: body,
isSpecial: isSpecial,
isMultiline: opt.isMultiline || false,
isMalformed: opt.isMalformed || false
};
}
return {
type: Token.Comment,
commentType: commentType,
value: value,
body: body,
isSpecial: isSpecial,
isMultiline: opt.isMultiline || false,
isMalformed: opt.isMalformed || false
};
}
// End of unbegun comment. Raise an error and skip that input.
if (ch1 === "*" && ch2 === "/") {
this.trigger("error", {
code: "E018",
line: startLine,
character: startChar
});
// End of unbegun comment. Raise an error and skip that input.
if (ch1 === "*" && ch2 === "/") {
this.trigger("error", {
code: "E018",
line: startLine,
character: startChar
});
this.skip(2);
return null;
}
this.skip(2);
return null;
}
// Comments must start either with // or /*
if (ch1 !== "/" || (ch2 !== "*" && ch2 !== "/")) {
return null;
}
// Comments must start either with // or /*
if (ch1 !== "/" || (ch2 !== "*" && ch2 !== "/")) {
return null;
}
// One-line comment
if (ch2 === "/") {
this.skip(this.input.length); // Skip to the EOL.
return commentToken("//", rest);
}
// One-line comment
if (ch2 === "/") {
this.skip(this.input.length); // Skip to the EOL.
return commentToken("//", rest);
}
var body = "";
var body = "";
/* Multi-line comment */
if (ch2 === "*") {
this.inComment = true;
this.skip(2);
/* Multi-line comment */
if (ch2 === "*") {
this.inComment = true;
this.skip(2);
while (this.peek() !== "*" || this.peek(1) !== "/") {
if (this.peek() === "") { // End of Line
body += "\n";
while (this.peek() !== "*" || this.peek(1) !== "/") {
if (this.peek() === "") { // End of Line
body += "\n";
// If we hit EOF and our comment is still unclosed,
// trigger an error and end the comment implicitly.
if (!this.nextLine()) {
this.trigger("error", {
code: "E017",
line: startLine,
character: startChar
});
// If we hit EOF and our comment is still unclosed,
// trigger an error and end the comment implicitly.
if (!this.nextLine()) {
this.trigger("error", {
code: "E017",
line: startLine,
character: startChar
});
this.inComment = false;
return commentToken("/*", body, {
isMultiline: true,
isMalformed: true
});
}
} else {
body += this.peek();
this.skip();
}
}
this.inComment = false;
return commentToken("/*", body, {
isMultiline: true,
isMalformed: true
});
}
} else {
body += this.peek();
this.skip();
}
}
this.skip(2);
this.inComment = false;
return commentToken("/*", body, { isMultiline: true });
}
},
this.skip(2);
this.inComment = false;
return commentToken("/*", body, { isMultiline: true });
}
},
/*
* Extract a keyword out of the next sequence of characters or
* return 'null' if its not possible.
*/
scanKeyword: function () {
var result = /^[a-zA-Z_$][a-zA-Z0-9_$]*/.exec(this.input);
var keywords = [
"if", "in", "do", "var", "for", "new",
"try", "let", "this", "else", "case",
"void", "with", "enum", "while", "break",
"catch", "throw", "const", "yield", "class",
"super", "return", "typeof", "delete",
"switch", "export", "import", "default",
"finally", "extends", "function", "continue",
"debugger", "instanceof"
];
/*
* Extract a keyword out of the next sequence of characters or
* return 'null' if its not possible.
*/
scanKeyword: function () {
var result = /^[a-zA-Z_$][a-zA-Z0-9_$]*/.exec(this.input);
var keywords = [
"if", "in", "do", "var", "for", "new",
"try", "let", "this", "else", "case",
"void", "with", "enum", "while", "break",
"catch", "throw", "const", "yield", "class",
"super", "return", "typeof", "delete",
"switch", "export", "import", "default",
"finally", "extends", "function", "continue",
"debugger", "instanceof"
];
if (result && keywords.indexOf(result[0]) >= 0) {
return {
type: Token.Keyword,
value: result[0]
};
}
if (result && keywords.indexOf(result[0]) >= 0) {
return {
type: Token.Keyword,
value: result[0]
};
}
return null;
},
return null;
},
/*
* Extract a JavaScript identifier out of the next sequence of
* characters or return 'null' if its not possible. In addition,
* to Identifier this method can also produce BooleanLiteral
* (true/false) and NullLiteral (null).
*/
scanIdentifier: function () {
var id = "";
var index = 0;
var type, char;
/*
* Extract a JavaScript identifier out of the next sequence of
* characters or return 'null' if its not possible. In addition,
* to Identifier this method can also produce BooleanLiteral
* (true/false) and NullLiteral (null).
*/
scanIdentifier: function () {
var id = "";
var index = 0;
var type, char;
function isNonAsciiIdentifierStart(code) {
return nonAsciiIdentifierStartTable.indexOf(code) > -1;
}
function isNonAsciiIdentifierStart(code) {
return nonAsciiIdentifierStartTable.indexOf(code) > -1;
}
function isNonAsciiIdentifierPart(code) {
return isNonAsciiIdentifierStart(code) || nonAsciiIdentifierPartTable.indexOf(code) > -1;
}
function isNonAsciiIdentifierPart(code) {
return isNonAsciiIdentifierStart(code) || nonAsciiIdentifierPartTable.indexOf(code) > -1;
}
function isHexDigit(str) {
return (/^[0-9a-fA-F]$/).test(str);
}
function isHexDigit(str) {
return (/^[0-9a-fA-F]$/).test(str);
}
var readUnicodeEscapeSequence = function () {
/*jshint validthis:true */
index += 1;
var readUnicodeEscapeSequence = function () {
/*jshint validthis:true */
index += 1;
if (this.peek(index) !== "u") {
return null;
}
if (this.peek(index) !== "u") {
return null;
}
var ch1 = this.peek(index + 1);
var ch2 = this.peek(index + 2);
var ch3 = this.peek(index + 3);
var ch4 = this.peek(index + 4);
var code;
var ch1 = this.peek(index + 1);
var ch2 = this.peek(index + 2);
var ch3 = this.peek(index + 3);
var ch4 = this.peek(index + 4);
var code;
if (isHexDigit(ch1) && isHexDigit(ch2) && isHexDigit(ch3) && isHexDigit(ch4)) {
code = parseInt(ch1 + ch2 + ch3 + ch4, 16);
if (isHexDigit(ch1) && isHexDigit(ch2) && isHexDigit(ch3) && isHexDigit(ch4)) {
code = parseInt(ch1 + ch2 + ch3 + ch4, 16);
if (asciiIdentifierPartTable[code] || isNonAsciiIdentifierPart(code)) {
index += 5;
return "\\u" + ch1 + ch2 + ch3 + ch4;
}
if (asciiIdentifierPartTable[code] || isNonAsciiIdentifierPart(code)) {
index += 5;
return "\\u" + ch1 + ch2 + ch3 + ch4;
}
return null;
}
return null;
}
return null;
}.bind(this);
return null;
}.bind(this);
var getIdentifierStart = function () {
/*jshint validthis:true */
var chr = this.peek(index);
var code = chr.charCodeAt(0);
var getIdentifierStart = function () {
/*jshint validthis:true */
var chr = this.peek(index);
var code = chr.charCodeAt(0);
if (code === 92) {
return readUnicodeEscapeSequence();
}
if (code === 92) {
return readUnicodeEscapeSequence();
}
if (code < 128) {
if (asciiIdentifierStartTable[code]) {
index += 1;
return chr;
}
if (code < 128) {
if (asciiIdentifierStartTable[code]) {
index += 1;
return chr;
}
return null;
}
return null;
}
if (isNonAsciiIdentifierStart(code)) {
index += 1;
return chr;
}
if (isNonAsciiIdentifierStart(code)) {
index += 1;
return chr;
}
return null;
}.bind(this);
return null;
}.bind(this);
var getIdentifierPart = function () {
/*jshint validthis:true */
var chr = this.peek(index);
var code = chr.charCodeAt(0);
var getIdentifierPart = function () {
/*jshint validthis:true */
var chr = this.peek(index);
var code = chr.charCodeAt(0);
if (code === 92) {
return readUnicodeEscapeSequence();
}
if (code === 92) {
return readUnicodeEscapeSequence();
}
if (code < 128) {
if (asciiIdentifierPartTable[code]) {
index += 1;
return chr;
}
if (code < 128) {
if (asciiIdentifierPartTable[code]) {
index += 1;
return chr;
}
return null;
}
return null;
}
if (isNonAsciiIdentifierPart(code)) {
index += 1;
return chr;
}
if (isNonAsciiIdentifierPart(code)) {
index += 1;
return chr;
}
return null;
}.bind(this);
return null;
}.bind(this);
char = getIdentifierStart();
if (char === null) {
return null;
}
char = getIdentifierStart();
if (char === null) {
return null;
}
id = char;
for (;;) {
char = getIdentifierPart();
id = char;
for (;;) {
char = getIdentifierPart();
if (char === null) {
break;
}
if (char === null) {
break;
}
id += char;
}
id += char;
}
switch (id) {
case "true":
case "false":
type = Token.BooleanLiteral;
break;
case "null":
type = Token.NullLiteral;
break;
default:
type = Token.Identifier;
}
switch (id) {
case "true":
case "false":
type = Token.BooleanLiteral;
break;
case "null":
type = Token.NullLiteral;
break;
default:
type = Token.Identifier;
}
return {
type: type,
value: id
};
},
return {
type: type,
value: id
};
},
/*
* Extract a numeric literal out of the next sequence of
* characters or return 'null' if its not possible. This method
* supports all numeric literals described in section 7.8.3
* of the EcmaScript 5 specification.
*
* This method's implementation was heavily influenced by the
* scanNumericLiteral function in the Esprima parser's source code.
*/
scanNumericLiteral: function () {
var index = 0;
var value = "";
var length = this.input.length;
var char = this.peek(index);
var bad;
/*
* Extract a numeric literal out of the next sequence of
* characters or return 'null' if its not possible. This method
* supports all numeric literals described in section 7.8.3
* of the EcmaScript 5 specification.
*
* This method's implementation was heavily influenced by the
* scanNumericLiteral function in the Esprima parser's source code.
*/
scanNumericLiteral: function () {
var index = 0;
var value = "";
var length = this.input.length;
var char = this.peek(index);
var bad;
function isDecimalDigit(str) {
return (/^[0-9]$/).test(str);
}
function isDecimalDigit(str) {
return (/^[0-9]$/).test(str);
}
function isOctalDigit(str) {
return (/^[0-7]$/).test(str);
}
function isOctalDigit(str) {
return (/^[0-7]$/).test(str);
}
function isHexDigit(str) {
return (/^[0-9a-fA-F]$/).test(str);
}
function isHexDigit(str) {
return (/^[0-9a-fA-F]$/).test(str);
}
function isIdentifierStart(ch) {
return (ch === "$") || (ch === "_") || (ch === "\\") ||
(ch >= "a" && ch <= "z") || (ch >= "A" && ch <= "Z");
}
function isIdentifierStart(ch) {
return (ch === "$") || (ch === "_") || (ch === "\\") ||
(ch >= "a" && ch <= "z") || (ch >= "A" && ch <= "Z");
}
// Numbers must start either with a decimal digit or a point.
// Numbers must start either with a decimal digit or a point.
if (char !== "." && !isDecimalDigit(char)) {
return null;
}
if (char !== "." && !isDecimalDigit(char)) {
return null;
}
if (char !== ".") {
value = this.peek(index);
index += 1;
char = this.peek(index);
if (char !== ".") {
value = this.peek(index);
index += 1;
char = this.peek(index);
if (value === "0") {
// Base-16 numbers.
if (char === "x" || char === "X") {
index += 1;
value += char;
if (value === "0") {
// Base-16 numbers.
if (char === "x" || char === "X") {
index += 1;
value += char;
while (index < length) {
char = this.peek(index);
if (!isHexDigit(char)) {
break;
}
value += char;
index += 1;
}
while (index < length) {
char = this.peek(index);
if (!isHexDigit(char)) {
break;
}
value += char;
index += 1;
}
if (value.length <= 2) { // 0x
return {
type: Token.NumericLiteral,
value: value,
isMalformed: true
};
}
if (value.length <= 2) { // 0x
return {
type: Token.NumericLiteral,
value: value,
isMalformed: true
};
}
if (index < length) {
char = this.peek(index);
if (isIdentifierStart(char)) {
return null;
}
}
if (index < length) {
char = this.peek(index);
if (isIdentifierStart(char)) {
return null;
}
}
return {
type: Token.NumericLiteral,
value: value,
base: 16,
isMalformed: false
};
}
return {
type: Token.NumericLiteral,
value: value,
base: 16,
isMalformed: false
};
}
// Base-8 numbers.
if (isOctalDigit(char)) {
index += 1;
value += char;
bad = false;
// Base-8 numbers.
if (isOctalDigit(char)) {
index += 1;
value += char;
bad = false;
while (index < length) {
char = this.peek(index);
while (index < length) {
char = this.peek(index);
// Numbers like '019' (note the 9) are not valid octals
// but we still parse them and mark as malformed.
// Numbers like '019' (note the 9) are not valid octals
// but we still parse them and mark as malformed.
if (isDecimalDigit(char)) {
bad = true;
} else if (!isOctalDigit(char)) {
break;
}
value += char;
index += 1;
}
if (isDecimalDigit(char)) {
bad = true;
} else if (!isOctalDigit(char)) {
break;
}
value += char;
index += 1;
}
if (index < length) {
char = this.peek(index);
if (isIdentifierStart(char)) {
return null;
}
}
if (index < length) {
char = this.peek(index);
if (isIdentifierStart(char)) {
return null;
}
}
return {
type: Token.NumericLiteral,
value: value,
base: 8,
isMalformed: false
};
}
return {
type: Token.NumericLiteral,
value: value,
base: 8,
isMalformed: false
};
}
// Decimal numbers that start with '0' such as '09' are illegal
// but we still parse them and return as malformed.
// Decimal numbers that start with '0' such as '09' are illegal
// but we still parse them and return as malformed.
if (isDecimalDigit(char)) {
index += 1;
value += char;
}
}
if (isDecimalDigit(char)) {
index += 1;
value += char;
}
}
while (index < length) {
char = this.peek(index);
if (!isDecimalDigit(char)) {
break;
}
value += char;
index += 1;
}
}
while (index < length) {
char = this.peek(index);
if (!isDecimalDigit(char)) {
break;
}
value += char;
index += 1;
}
}
// Decimal digits.
// Decimal digits.
if (char === ".") {
value += char;
index += 1;
if (char === ".") {
value += char;
index += 1;
while (index < length) {
char = this.peek(index);
if (!isDecimalDigit(char)) {
break;
}
value += char;
index += 1;
}
}
while (index < length) {
char = this.peek(index);
if (!isDecimalDigit(char)) {
break;
}
value += char;
index += 1;
}
}
// Exponent part.
// Exponent part.
if (char === "e" || char === "E") {
value += char;
index += 1;
char = this.peek(index);
if (char === "e" || char === "E") {
value += char;
index += 1;
char = this.peek(index);
if (char === "+" || char === "-") {
value += this.peek(index);
index += 1;
}
if (char === "+" || char === "-") {
value += this.peek(index);
index += 1;
}
char = this.peek(index);
if (isDecimalDigit(char)) {
value += char;
index += 1;
char = this.peek(index);
if (isDecimalDigit(char)) {
value += char;
index += 1;
while (index < length) {
char = this.peek(index);
if (!isDecimalDigit(char)) {
break;
}
value += char;
index += 1;
}
} else {
return null;
}
}
while (index < length) {
char = this.peek(index);
if (!isDecimalDigit(char)) {
break;
}
value += char;
index += 1;
}
} else {
return null;
}
}
if (index < length) {
char = this.peek(index);
if (isIdentifierStart(char)) {
return null;
}
}
if (index < length) {
char = this.peek(index);
if (isIdentifierStart(char)) {
return null;
}
}
return {
type: Token.NumericLiteral,
value: value,
base: 10,
isMalformed: !isFinite(value)
};
},
return {
type: Token.NumericLiteral,
value: value,
base: 10,
isMalformed: !isFinite(value)
};
},
/*
* Extract a string out of the next sequence of characters and/or
* lines or return 'null' if its not possible. Since strings can
* span across multiple lines this method has to move the char
* pointer.
*
* This method recognizes pseudo-multiline JavaScript strings:
*
* var str = "hello\
* world";
*/
scanStringLiteral: function (checks) {
/*jshint loopfunc:true */
var quote = this.peek();
/*
* Extract a string out of the next sequence of characters and/or
* lines or return 'null' if its not possible. Since strings can
* span across multiple lines this method has to move the char
* pointer.
*
* This method recognizes pseudo-multiline JavaScript strings:
*
* var str = "hello\
* world";
*/
scanStringLiteral: function (checks) {
/*jshint loopfunc:true */
var quote = this.peek();
// String must start with a quote.
if (quote !== "\"" && quote !== "'") {
return null;
}
// String must start with a quote.
if (quote !== "\"" && quote !== "'") {
return null;
}
// In JSON strings must always use double quotes.
this.triggerAsync("warning", {
code: "W108",
line: this.line,
character: this.char // +1?
}, checks, function () { return state.jsonMode && quote !== "\""; });
// In JSON strings must always use double quotes.
this.triggerAsync("warning", {
code: "W108",
line: this.line,
character: this.char // +1?
}, checks, function () { return state.jsonMode && quote !== "\""; });
var value = "";
var startLine = this.line;
var startChar = this.char;
var allowNewLine = false;
var value = "";
var startLine = this.line;
var startChar = this.char;
var allowNewLine = false;
this.skip();
this.skip();
while (this.peek() !== quote) {
while (this.peek() === "") { // End Of Line
while (this.peek() !== quote) {
while (this.peek() === "") { // End Of Line
// If an EOL is not preceded by a backslash, show a warning
// and proceed like it was a legit multi-line string where
// author simply forgot to escape the newline symbol.
//
// Another approach is to implicitly close a string on EOL
// but it generates too many false positives.
// If an EOL is not preceded by a backslash, show a warning
// and proceed like it was a legit multi-line string where
// author simply forgot to escape the newline symbol.
//
// Another approach is to implicitly close a string on EOL
// but it generates too many false positives.
if (!allowNewLine) {
this.trigger("warning", {
code: "W112",
line: this.line,
character: this.char
});
} else {
allowNewLine = false;
if (!allowNewLine) {
this.trigger("warning", {
code: "W112",
line: this.line,
character: this.char
});
} else {
allowNewLine = false;
// Otherwise show a warning if multistr option was not set.
// For JSON, show warning no matter what.
// Otherwise show a warning if multistr option was not set.
// For JSON, show warning no matter what.
this.triggerAsync("warning", {
code: "W043",
line: this.line,
character: this.char
}, checks, function () { return !state.option.multistr; });
this.triggerAsync("warning", {
code: "W043",
line: this.line,
character: this.char
}, checks, function () { return !state.option.multistr; });
this.triggerAsync("warning", {
code: "W042",
line: this.line,
character: this.char
}, checks, function () { return state.jsonMode && state.option.multistr; });
}
this.triggerAsync("warning", {
code: "W042",
line: this.line,
character: this.char
}, checks, function () { return state.jsonMode && state.option.multistr; });
}
// If we get an EOF inside of an unclosed string, show an
// error and implicitly close it at the EOF point.
// If we get an EOF inside of an unclosed string, show an
// error and implicitly close it at the EOF point.
if (!this.nextLine()) {
this.trigger("error", {
code: "E029",
line: startLine,
character: startChar
});
if (!this.nextLine()) {
this.trigger("error", {
code: "E029",
line: startLine,
character: startChar
});
return {
type: Token.StringLiteral,
value: value,
isUnclosed: true,
quote: quote
};
}
}
return {
type: Token.StringLiteral,
value: value,
isUnclosed: true,
quote: quote
};
}
}
allowNewLine = false;
var char = this.peek();
var jump = 1; // A length of a jump, after we're done
// parsing this character.
allowNewLine = false;
var char = this.peek();
var jump = 1; // A length of a jump, after we're done
// parsing this character.
if (char < " ") {
// Warn about a control character in a string.
this.trigger("warning", {
code: "W113",
line: this.line,
character: this.char,
data: [ "<non-printable>" ]
});
}
if (char < " ") {
// Warn about a control character in a string.
this.trigger("warning", {
code: "W113",
line: this.line,
character: this.char,
data: [ "<non-printable>" ]
});
}
// Special treatment for some escaped characters.
// Special treatment for some escaped characters.
if (char === "\\") {
this.skip();
char = this.peek();
if (char === "\\") {
this.skip();
char = this.peek();
switch (char) {
case "'":
this.triggerAsync("warning", {
code: "W114",
line: this.line,
character: this.char,
data: [ "\\'" ]
}, checks, function () {return state.jsonMode; });
break;
case "b":
char = "\\b";
break;
case "f":
char = "\\f";
break;
case "n":
char = "\\n";
break;
case "r":
char = "\\r";
break;
case "t":
char = "\\t";
break;
case "0":
char = "\\0";
switch (char) {
case "'":
this.triggerAsync("warning", {
code: "W114",
line: this.line,
character: this.char,
data: [ "\\'" ]
}, checks, function () {return state.jsonMode; });
break;
case "b":
char = "\\b";
break;
case "f":
char = "\\f";
break;
case "n":
char = "\\n";
break;
case "r":
char = "\\r";
break;
case "t":
char = "\\t";
break;
case "0":
char = "\\0";
// Octal literals fail in strict mode.
// Check if the number is between 00 and 07.
var n = parseInt(this.peek(1), 10);
this.triggerAsync("warning", {
code: "W115",
line: this.line,
character: this.char
}, checks,
function () { return n >= 0 && n <= 7 && state.directive["use strict"]; });
break;
case "u":
char = String.fromCharCode(parseInt(this.input.substr(1, 4), 16));
jump = 5;
break;
case "v":
this.triggerAsync("warning", {
code: "W114",
line: this.line,
character: this.char,
data: [ "\\v" ]
}, checks, function () { return state.jsonMode; });
// Octal literals fail in strict mode.
// Check if the number is between 00 and 07.
var n = parseInt(this.peek(1), 10);
this.triggerAsync("warning", {
code: "W115",
line: this.line,
character: this.char
}, checks,
function () { return n >= 0 && n <= 7 && state.directive["use strict"]; });
break;
case "u":
char = String.fromCharCode(parseInt(this.input.substr(1, 4), 16));
jump = 5;
break;
case "v":
this.triggerAsync("warning", {
code: "W114",
line: this.line,
character: this.char,
data: [ "\\v" ]
}, checks, function () { return state.jsonMode; });
char = "\v";
break;
case "x":
var x = parseInt(this.input.substr(1, 2), 16);
char = "\v";
break;
case "x":
var x = parseInt(this.input.substr(1, 2), 16);
this.triggerAsync("warning", {
code: "W114",
line: this.line,
character: this.char,
data: [ "\\x-" ]
}, checks, function () { return state.jsonMode; });
this.triggerAsync("warning", {
code: "W114",
line: this.line,
character: this.char,
data: [ "\\x-" ]
}, checks, function () { return state.jsonMode; });
char = String.fromCharCode(x);
jump = 3;
break;
case "\\":
char = "\\\\";
break;
case "\"":
char = "\\\"";
break;
case "/":
break;
case "":
allowNewLine = true;
char = "";
break;
case "!":
if (value.slice(value.length - 2) === "<") {
break;
}
char = String.fromCharCode(x);
jump = 3;
break;
case "\\":
char = "\\\\";
break;
case "\"":
char = "\\\"";
break;
case "/":
break;
case "":
allowNewLine = true;
char = "";
break;
case "!":
if (value.slice(value.length - 2) === "<") {
break;
}
/*falls through */
default:
// Weird escaping.
this.trigger("warning", {
code: "W044",
line: this.line,
character: this.char
});
}
}
/*falls through */
default:
// Weird escaping.
this.trigger("warning", {
code: "W044",
line: this.line,
character: this.char
});
}
}
value += char;
this.skip(jump);
}
value += char;
this.skip(jump);
}
this.skip();
return {
type: Token.StringLiteral,
value: value,
isUnclosed: false,
quote: quote
};
},
this.skip();
return {
type: Token.StringLiteral,
value: value,
isUnclosed: false,
quote: quote
};
},
/*
* Extract a regular expression out of the next sequence of
* characters and/or lines or return 'null' if its not possible.
*
* This method is platform dependent: it accepts almost any
* regular expression values but then tries to compile and run
* them using system's RegExp object. This means that there are
* rare edge cases where one JavaScript engine complains about
* your regular expression while others don't.
*/
scanRegExp: function () {
var index = 0;
var length = this.input.length;
var char = this.peek();
var value = char;
var body = "";
var flags = [];
var malformed = false;
var isCharSet = false;
var terminated;
/*
* Extract a regular expression out of the next sequence of
* characters and/or lines or return 'null' if its not possible.
*
* This method is platform dependent: it accepts almost any
* regular expression values but then tries to compile and run
* them using system's RegExp object. This means that there are
* rare edge cases where one JavaScript engine complains about
* your regular expression while others don't.
*/
scanRegExp: function () {
var index = 0;
var length = this.input.length;
var char = this.peek();
var value = char;
var body = "";
var flags = [];
var malformed = false;
var isCharSet = false;
var terminated;
var scanUnexpectedChars = function () {
// Unexpected control character
if (char < " ") {
malformed = true;
this.trigger("warning", {
code: "W048",
line: this.line,
character: this.char
});
}
var scanUnexpectedChars = function () {
// Unexpected control character
if (char < " ") {
malformed = true;
this.trigger("warning", {
code: "W048",
line: this.line,
character: this.char
});
}
// Unexpected escaped character
if (char === "<") {
malformed = true;
this.trigger("warning", {
code: "W049",
line: this.line,
character: this.char,
data: [ char ]
});
}
}.bind(this);
// Unexpected escaped character
if (char === "<") {
malformed = true;
this.trigger("warning", {
code: "W049",
line: this.line,
character: this.char,
data: [ char ]
});
}
}.bind(this);
// Regular expressions must start with '/'
if (!this.prereg || char !== "/") {
return null;
}
// Regular expressions must start with '/'
if (!this.prereg || char !== "/") {
return null;
}
index += 1;
terminated = false;
index += 1;
terminated = false;
// Try to get everything in between slashes. A couple of
// cases aside (see scanUnexpectedChars) we don't really
// care whether the resulting expression is valid or not.
// We will check that later using the RegExp object.
// Try to get everything in between slashes. A couple of
// cases aside (see scanUnexpectedChars) we don't really
// care whether the resulting expression is valid or not.
// We will check that later using the RegExp object.
while (index < length) {
char = this.peek(index);
value += char;
body += char;
while (index < length) {
char = this.peek(index);
value += char;
body += char;
if (isCharSet) {
if (char === "]") {
if (this.peek(index - 1) !== "\\" || this.peek(index - 2) === "\\") {
isCharSet = false;
}
}
if (isCharSet) {
if (char === "]") {
if (this.peek(index - 1) !== "\\" || this.peek(index - 2) === "\\") {
isCharSet = false;
}
}
if (char === "\\") {
index += 1;
char = this.peek(index);
body += char;
value += char;
if (char === "\\") {
index += 1;
char = this.peek(index);
body += char;
value += char;
scanUnexpectedChars();
}
scanUnexpectedChars();
}
index += 1;
continue;
}
index += 1;
continue;
}
if (char === "\\") {
index += 1;
char = this.peek(index);
body += char;
value += char;
if (char === "\\") {
index += 1;
char = this.peek(index);
body += char;
value += char;
scanUnexpectedChars();
scanUnexpectedChars();
if (char === "/") {
index += 1;
continue;
}
if (char === "/") {
index += 1;
continue;
}
if (char === "[") {
index += 1;
continue;
}
}
if (char === "[") {
index += 1;
continue;
}
}
if (char === "[") {
isCharSet = true;
index += 1;
continue;
}
if (char === "[") {
isCharSet = true;
index += 1;
continue;
}
if (char === "/") {
body = body.substr(0, body.length - 1);
terminated = true;
index += 1;
break;
}
if (char === "/") {
body = body.substr(0, body.length - 1);
terminated = true;
index += 1;
break;
}
index += 1;
}
index += 1;
}
// A regular expression that was never closed is an
// error from which we cannot recover.
// A regular expression that was never closed is an
// error from which we cannot recover.
if (!terminated) {
this.trigger("error", {
code: "E015",
line: this.line,
character: this.from
});
if (!terminated) {
this.trigger("error", {
code: "E015",
line: this.line,
character: this.from
});
return void this.trigger("fatal", {
line: this.line,
from: this.from
});
}
return void this.trigger("fatal", {
line: this.line,
from: this.from
});
}
// Parse flags (if any).
// Parse flags (if any).
while (index < length) {
char = this.peek(index);
if (!/[gim]/.test(char)) {
break;
}
flags.push(char);
value += char;
index += 1;
}
while (index < length) {
char = this.peek(index);
if (!/[gim]/.test(char)) {
break;
}
flags.push(char);
value += char;
index += 1;
}
// Check regular expression for correctness.
// Check regular expression for correctness.
try {
new RegExp(body, flags.join(""));
} catch (err) {
malformed = true;
this.trigger("error", {
code: "E016",
line: this.line,
character: this.char,
data: [ err.message ] // Platform dependent!
});
}
try {
new RegExp(body, flags.join(""));
} catch (err) {
malformed = true;
this.trigger("error", {
code: "E016",
line: this.line,
character: this.char,
data: [ err.message ] // Platform dependent!
});
}
return {
type: Token.RegExp,
value: value,
flags: flags,
isMalformed: malformed
};
},
return {
type: Token.RegExp,
value: value,
flags: flags,
isMalformed: malformed
};
},
/*
* Scan for any occurence of mixed tabs and spaces. If smarttabs option
* is on, ignore tabs followed by spaces.
*
* Tabs followed by one space followed by a block comment are allowed.
*/
scanMixedSpacesAndTabs: function () {
var at, match;
/*
* Scan for any occurence of mixed tabs and spaces. If smarttabs option
* is on, ignore tabs followed by spaces.
*
* Tabs followed by one space followed by a block comment are allowed.
*/
scanMixedSpacesAndTabs: function () {
var at, match;
if (state.option.smarttabs) {
// Negative look-behind for "//"
match = this.input.match(/(\/\/|^\s?\*)? \t/);
at = match && !match[1] ? 0 : -1;
} else {
at = this.input.search(/ \t|\t [^\*]/);
}
if (state.option.smarttabs) {
// Negative look-behind for "//"
match = this.input.match(/(\/\/|^\s?\*)? \t/);
at = match && !match[1] ? 0 : -1;
} else {
at = this.input.search(/ \t|\t [^\*]/);
}
return at;
},
return at;
},
/*
* Scan for characters that get silently deleted by one or more browsers.
*/
scanUnsafeChars: function () {
return this.input.search(reg.unsafeChars);
},
/*
* Scan for any occurence of non-breaking spaces. Non-breaking spaces
* can be mistakenly typed on OS X with option-space. Non UTF-8 web
* pages with non-breaking pages produce syntax errors.
*/
scanNonBreakingSpaces: function () {
return state.option.nonbsp ?
this.input.search(/(\u00A0)/) : -1;
},
/*
* Produce the next raw token or return 'null' if no tokens can be matched.
* This method skips over all space characters.
*/
next: function (checks) {
this.from = this.char;
/*
* Scan for characters that get silently deleted by one or more browsers.
*/
scanUnsafeChars: function () {
return this.input.search(reg.unsafeChars);
},
// Move to the next non-space character.
var start;
if (/\s/.test(this.peek())) {
start = this.char;
/*
* Produce the next raw token or return 'null' if no tokens can be matched.
* This method skips over all space characters.
*/
next: function (checks) {
this.from = this.char;
while (/\s/.test(this.peek())) {
this.from += 1;
this.skip();
}
// Move to the next non-space character.
var start;
if (/\s/.test(this.peek())) {
start = this.char;
if (this.peek() === "") { // EOL
if (!/^\s*$/.test(this.getLines()[this.line - 1]) && state.option.trailing) {
this.trigger("warning", { code: "W102", line: this.line, character: start });
}
}
}
while (/\s/.test(this.peek())) {
this.from += 1;
this.skip();
}
// Methods that work with multi-line structures and move the
// character pointer.
if (this.peek() === "") { // EOL
if (!/^\s*$/.test(this.getLines()[this.line - 1]) && state.option.trailing) {
this.trigger("warning", { code: "W102", line: this.line, character: start });
}
}
}
var match = this.scanComments() ||
this.scanStringLiteral(checks);
// Methods that work with multi-line structures and move the
// character pointer.
if (match) {
return match;
}
var match = this.scanComments() ||
this.scanStringLiteral(checks);
// Methods that don't move the character pointer.
if (match) {
return match;
}
match =
this.scanRegExp() ||
this.scanPunctuator() ||
this.scanKeyword() ||
this.scanIdentifier() ||
this.scanNumericLiteral();
// Methods that don't move the character pointer.
if (match) {
this.skip(match.value.length);
return match;
}
match =
this.scanRegExp() ||
this.scanPunctuator() ||
this.scanKeyword() ||
this.scanIdentifier() ||
this.scanNumericLiteral();
// No token could be matched, give up.
if (match) {
this.skip(match.value.length);
return match;
}
return null;
},
// No token could be matched, give up.
/*
* Switch to the next line and reset all char pointers. Once
* switched, this method also checks for mixed spaces and tabs
* and other minor warnings.
*/
nextLine: function () {
var char;
return null;
},
if (this.line >= this.getLines().length) {
return false;
}
/*
* Switch to the next line and reset all char pointers. Once
* switched, this method also checks for mixed spaces and tabs
* and other minor warnings.
*/
nextLine: function () {
var char;
this.input = this.getLines()[this.line];
this.line += 1;
this.char = 1;
this.from = 1;
if (this.line >= this.getLines().length) {
return false;
}
var startsWith = function (prefix) {
return this.indexOf(prefix) === 0;
};
var endsWith = function (suffix) {
return this.indexOf(suffix, this.length - suffix.length) !== -1;
};
var inputTrimmed = this.input.trim();
this.input = this.getLines()[this.line];
this.line += 1;
this.char = 1;
this.from = 1;
// If we are ignoring linter errors, replace the input with empty string
// if it doesn't already at least start or end a multi-line comment
if (state.ignoreLinterErrors === true) {
if (! (startsWith.call(inputTrimmed, "/*") || endsWith.call(inputTrimmed, "*/"))) {
this.input = "";
}
}
var inputTrimmed = this.input.trim();
char = this.scanMixedSpacesAndTabs();
if (char >= 0) {
this.trigger("warning", { code: "W099", line: this.line, character: char + 1 });
}
var startsWith = function () {
return _.some(arguments, function (prefix) {
return inputTrimmed.indexOf(prefix) === 0;
});
};
this.input = this.input.replace(/\t/g, state.tab);
char = this.scanUnsafeChars();
var endsWith = function () {
return _.some(arguments, function (suffix) {
return inputTrimmed.indexOf(suffix, inputTrimmed.length - suffix.length) !== -1;
});
};
if (char >= 0) {
this.trigger("warning", { code: "W100", line: this.line, character: char });
}
// If we are ignoring linter errors, replace the input with empty string
// if it doesn't already at least start or end a multi-line comment
if (state.ignoreLinterErrors === true) {
if (!startsWith("/*", "//") && !endsWith("*/")) {
this.input = "";
}
}
// If there is a limit on line length, warn when lines get too
// long.
char = this.scanNonBreakingSpaces();
if (char >= 0) {
this.trigger("warning", { code: "W125", line: this.line, character: char + 1 });
}
if (state.option.maxlen && state.option.maxlen < this.input.length) {
var inComment = this.inComment ||
startsWith.call(inputTrimmed, "//") ||
startsWith.call(inputTrimmed, "/*");
char = this.scanMixedSpacesAndTabs();
if (char >= 0) {
this.trigger("warning", { code: "W099", line: this.line, character: char + 1 });
}
var shouldTriggerError = !inComment || !reg.maxlenException.test(inputTrimmed);
this.input = this.input.replace(/\t/g, state.tab);
char = this.scanUnsafeChars();
if (shouldTriggerError) {
this.trigger("warning", { code: "W101", line: this.line, character: this.input.length });
}
}
if (char >= 0) {
this.trigger("warning", { code: "W100", line: this.line, character: char });
}
return true;
},
// If there is a limit on line length, warn when lines get too
// long.
/*
* This is simply a synonym for nextLine() method with a friendlier
* public name.
*/
start: function () {
this.nextLine();
},
if (state.option.maxlen && state.option.maxlen < this.input.length) {
var inComment = this.inComment ||
startsWith.call(inputTrimmed, "//") ||
startsWith.call(inputTrimmed, "/*");
/*
* Produce the next token. This function is called by advance() to get
* the next token. It retuns a token in a JSLint-compatible format.
*/
token: function () {
/*jshint loopfunc:true */
var checks = asyncTrigger();
var token;
var shouldTriggerError = !inComment || !reg.maxlenException.test(inputTrimmed);
if (shouldTriggerError) {
this.trigger("warning", { code: "W101", line: this.line, character: this.input.length });
}
}
function isReserved(token, isProperty) {
if (!token.reserved) {
return false;
}
var meta = token.meta;
return true;
},
if (meta && meta.isFutureReservedWord && state.option.inES5()) {
// ES3 FutureReservedWord in an ES5 environment.
if (!meta.es5) {
return false;
}
/*
* This is simply a synonym for nextLine() method with a friendlier
* public name.
*/
start: function () {
this.nextLine();
},
// Some ES5 FutureReservedWord identifiers are active only
// within a strict mode environment.
if (meta.strictOnly) {
if (!state.option.strict && !state.directive["use strict"]) {
return false;
}
}
/*
* Produce the next token. This function is called by advance() to get
* the next token. It retuns a token in a JSLint-compatible format.
*/
token: function () {
/*jshint loopfunc:true */
var checks = asyncTrigger();
var token;
if (isProperty) {
return false;
}
}
return true;
}
function isReserved(token, isProperty) {
if (!token.reserved) {
return false;
}
var meta = token.meta;
// Produce a token object.
var create = function (type, value, isProperty) {
/*jshint validthis:true */
var obj;
if (meta && meta.isFutureReservedWord && state.option.inES5()) {
// ES3 FutureReservedWord in an ES5 environment.
if (!meta.es5) {
return false;
}
if (type !== "(endline)" && type !== "(end)") {
this.prereg = false;
}
// Some ES5 FutureReservedWord identifiers are active only
// within a strict mode environment.
if (meta.strictOnly) {
if (!state.option.strict && !state.directive["use strict"]) {
return false;
}
}
if (type === "(punctuator)") {
switch (value) {
case ".":
case ")":
case "~":
case "#":
case "]":
this.prereg = false;
break;
default:
this.prereg = true;
}
if (isProperty) {
return false;
}
}
obj = Object.create(state.syntax[value] || state.syntax["(error)"]);
}
return true;
}
if (type === "(identifier)") {
if (value === "return" || value === "case" || value === "typeof") {
this.prereg = true;
}
// Produce a token object.
var create = function (type, value, isProperty) {
/*jshint validthis:true */
var obj;
if (_.has(state.syntax, value)) {
obj = Object.create(state.syntax[value] || state.syntax["(error)"]);
if (type !== "(endline)" && type !== "(end)") {
this.prereg = false;
}
// If this can't be a reserved keyword, reset the object.
if (!isReserved(obj, isProperty && type === "(identifier)")) {
obj = null;
}
}
}
if (type === "(punctuator)") {
switch (value) {
case ".":
case ")":
case "~":
case "#":
case "]":
this.prereg = false;
break;
default:
this.prereg = true;
}
if (!obj) {
obj = Object.create(state.syntax[type]);
}
obj = Object.create(state.syntax[value] || state.syntax["(error)"]);
}
obj.identifier = (type === "(identifier)");
obj.type = obj.type || type;
obj.value = value;
obj.line = this.line;
obj.character = this.char;
obj.from = this.from;
if (type === "(identifier)") {
if (value === "return" || value === "case" || value === "typeof") {
this.prereg = true;
}
if (isProperty && obj.identifier) {
obj.isProperty = isProperty;
}
if (_.has(state.syntax, value)) {
obj = Object.create(state.syntax[value] || state.syntax["(error)"]);
obj.check = checks.check;
// If this can't be a reserved keyword, reset the object.
if (!isReserved(obj, isProperty && type === "(identifier)")) {
obj = null;
}
}
}
return obj;
}.bind(this);
if (!obj) {
obj = Object.create(state.syntax[type]);
}
for (;;) {
if (!this.input.length) {
return create(this.nextLine() ? "(endline)" : "(end)", "");
}
obj.identifier = (type === "(identifier)");
obj.type = obj.type || type;
obj.value = value;
obj.line = this.line;
obj.character = this.char;
obj.from = this.from;
token = this.next(checks);
if (isProperty && obj.identifier) {
obj.isProperty = isProperty;
}
if (!token) {
if (this.input.length) {
// Unexpected character.
this.trigger("error", {
code: "E024",
line: this.line,
character: this.char,
data: [ this.peek() ]
});
obj.check = checks.check;
this.input = "";
}
return obj;
}.bind(this);
continue;
}
for (;;) {
if (!this.input.length) {
return create(this.nextLine() ? "(endline)" : "(end)", "");
}
switch (token.type) {
case Token.StringLiteral:
this.triggerAsync("String", {
line: this.line,
char: this.char,
from: this.from,
value: token.value,
quote: token.quote
}, checks, function () { return true; });
token = this.next(checks);
return create("(string)", token.value);
case Token.Identifier:
this.trigger("Identifier", {
line: this.line,
char: this.char,
from: this.form,
name: token.value,
isProperty: state.tokens.curr.id === "."
});
if (!token) {
if (this.input.length) {
// Unexpected character.
this.trigger("error", {
code: "E024",
line: this.line,
character: this.char,
data: [ this.peek() ]
});
/* falls through */
case Token.Keyword:
case Token.NullLiteral:
case Token.BooleanLiteral:
return create("(identifier)", token.value, state.tokens.curr.id === ".");
this.input = "";
}
case Token.NumericLiteral:
if (token.isMalformed) {
this.trigger("warning", {
code: "W045",
line: this.line,
character: this.char,
data: [ token.value ]
});
}
continue;
}
this.triggerAsync("warning", {
code: "W114",
line: this.line,
character: this.char,
data: [ "0x-" ]
}, checks, function () { return token.base === 16 && state.jsonMode; });
switch (token.type) {
case Token.StringLiteral:
this.triggerAsync("String", {
line: this.line,
char: this.char,
from: this.from,
value: token.value,
quote: token.quote
}, checks, function () { return true; });
this.triggerAsync("warning", {
code: "W115",
line: this.line,
character: this.char
}, checks, function () {
return state.directive["use strict"] && token.base === 8;
});
return create("(string)", token.value);
case Token.Identifier:
this.trigger("Identifier", {
line: this.line,
char: this.char,
from: this.form,
name: token.value,
isProperty: state.tokens.curr.id === "."
});
this.trigger("Number", {
line: this.line,
char: this.char,
from: this.from,
value: token.value,
base: token.base,
isMalformed: token.malformed
});
/* falls through */
case Token.Keyword:
case Token.NullLiteral:
case Token.BooleanLiteral:
return create("(identifier)", token.value, state.tokens.curr.id === ".");
return create("(number)", token.value);
case Token.NumericLiteral:
if (token.isMalformed) {
this.trigger("warning", {
code: "W045",
line: this.line,
character: this.char,
data: [ token.value ]
});
}
case Token.RegExp:
return create("(regexp)", token.value);
this.triggerAsync("warning", {
code: "W114",
line: this.line,
character: this.char,
data: [ "0x-" ]
}, checks, function () { return token.base === 16 && state.jsonMode; });
case Token.Comment:
state.tokens.curr.comment = true;
this.triggerAsync("warning", {
code: "W115",
line: this.line,
character: this.char
}, checks, function () {
return state.directive["use strict"] && token.base === 8;
});
if (token.isSpecial) {
return {
id: '(comment)',
value: token.value,
body: token.body,
type: token.commentType,
isSpecial: token.isSpecial,
line: this.line,
character: this.char,
from: this.from
};
}
this.trigger("Number", {
line: this.line,
char: this.char,
from: this.from,
value: token.value,
base: token.base,
isMalformed: token.malformed
});
break;
return create("(number)", token.value);
case "":
break;
case Token.RegExp:
return create("(regexp)", token.value);
default:
return create("(punctuator)", token.value);
}
}
}
case Token.Comment:
state.tokens.curr.comment = true;
if (token.isSpecial) {
return {
id: '(comment)',
value: token.value,
body: token.body,
type: token.commentType,
isSpecial: token.isSpecial,
line: this.line,
character: this.char,
from: this.from
};
}
break;
case "":
break;
default:
return create("(punctuator)", token.value);
}
}
}
};
exports.Lexer = Lexer;

@@ -6,201 +6,202 @@ "use strict";

var errors = {
// JSHint options
E001: "Bad option: '{a}'.",
E002: "Bad option value.",
// JSHint options
E001: "Bad option: '{a}'.",
E002: "Bad option value.",
// JSHint input
E003: "Expected a JSON value.",
E004: "Input is neither a string nor an array of strings.",
E005: "Input is empty.",
E006: "Unexpected early end of program.",
// JSHint input
E003: "Expected a JSON value.",
E004: "Input is neither a string nor an array of strings.",
E005: "Input is empty.",
E006: "Unexpected early end of program.",
// Strict mode
E007: "Missing \"use strict\" statement.",
E008: "Strict violation.",
E009: "Option 'validthis' can't be used in a global scope.",
E010: "'with' is not allowed in strict mode.",
// Strict mode
E007: "Missing \"use strict\" statement.",
E008: "Strict violation.",
E009: "Option 'validthis' can't be used in a global scope.",
E010: "'with' is not allowed in strict mode.",
// Constants
E011: "const '{a}' has already been declared.",
E012: "const '{a}' is initialized to 'undefined'.",
E013: "Attempting to override '{a}' which is a constant.",
// Constants
E011: "const '{a}' has already been declared.",
E012: "const '{a}' is initialized to 'undefined'.",
E013: "Attempting to override '{a}' which is a constant.",
// Regular expressions
E014: "A regular expression literal can be confused with '/='.",
E015: "Unclosed regular expression.",
E016: "Invalid regular expression.",
// Regular expressions
E014: "A regular expression literal can be confused with '/='.",
E015: "Unclosed regular expression.",
E016: "Invalid regular expression.",
// Tokens
E017: "Unclosed comment.",
E018: "Unbegun comment.",
E019: "Unmatched '{a}'.",
E020: "Expected '{a}' to match '{b}' from line {c} and instead saw '{d}'.",
E021: "Expected '{a}' and instead saw '{b}'.",
E022: "Line breaking error '{a}'.",
E023: "Missing '{a}'.",
E024: "Unexpected '{a}'.",
E025: "Missing ':' on a case clause.",
E026: "Missing '}' to match '{' from line {a}.",
E027: "Missing ']' to match '[' from line {a}.",
E028: "Illegal comma.",
E029: "Unclosed string.",
// Tokens
E017: "Unclosed comment.",
E018: "Unbegun comment.",
E019: "Unmatched '{a}'.",
E020: "Expected '{a}' to match '{b}' from line {c} and instead saw '{d}'.",
E021: "Expected '{a}' and instead saw '{b}'.",
E022: "Line breaking error '{a}'.",
E023: "Missing '{a}'.",
E024: "Unexpected '{a}'.",
E025: "Missing ':' on a case clause.",
E026: "Missing '}' to match '{' from line {a}.",
E027: "Missing ']' to match '[' from line {a}.",
E028: "Illegal comma.",
E029: "Unclosed string.",
// Everything else
E030: "Expected an identifier and instead saw '{a}'.",
E031: "Bad assignment.", // FIXME: Rephrase
E032: "Expected a small integer or 'false' and instead saw '{a}'.",
E033: "Expected an operator and instead saw '{a}'.",
E034: "get/set are ES5 features.",
E035: "Missing property name.",
E036: "Expected to see a statement and instead saw a block.",
E037: null,
E038: null,
E039: "Function declarations are not invocable. Wrap the whole function invocation in parens.",
E040: "Each value should have its own case label.",
E041: "Unrecoverable syntax error.",
E042: "Stopping.",
E043: "Too many errors.",
E044: null,
E045: "Invalid for each loop.",
E046: "A yield statement shall be within a generator function (with syntax: `function*`)",
E047: null, // Vacant
E048: "Let declaration not directly within block.",
E049: "A {a} cannot be named '{b}'.",
E050: "Mozilla requires the yield expression to be parenthesized here.",
E051: "Regular parameters cannot come after default parameters."
// Everything else
E030: "Expected an identifier and instead saw '{a}'.",
E031: "Bad assignment.", // FIXME: Rephrase
E032: "Expected a small integer or 'false' and instead saw '{a}'.",
E033: "Expected an operator and instead saw '{a}'.",
E034: "get/set are ES5 features.",
E035: "Missing property name.",
E036: "Expected to see a statement and instead saw a block.",
E037: null,
E038: null,
E039: "Function declarations are not invocable. Wrap the whole function invocation in parens.",
E040: "Each value should have its own case label.",
E041: "Unrecoverable syntax error.",
E042: "Stopping.",
E043: "Too many errors.",
E044: null,
E045: "Invalid for each loop.",
E046: "A yield statement shall be within a generator function (with syntax: `function*`)",
E047: null, // Vacant
E048: "Let declaration not directly within block.",
E049: "A {a} cannot be named '{b}'.",
E050: "Mozilla requires the yield expression to be parenthesized here.",
E051: "Regular parameters cannot come after default parameters."
};
var warnings = {
W001: "'hasOwnProperty' is a really bad name.",
W002: "Value of '{a}' may be overwritten in IE 8 and earlier.",
W003: "'{a}' was used before it was defined.",
W004: "'{a}' is already defined.",
W005: "A dot following a number can be confused with a decimal point.",
W006: "Confusing minuses.",
W007: "Confusing pluses.",
W008: "A leading decimal point can be confused with a dot: '{a}'.",
W009: "The array literal notation [] is preferable.",
W010: "The object literal notation {} is preferable.",
W011: "Unexpected space after '{a}'.",
W012: "Unexpected space before '{a}'.",
W013: "Missing space after '{a}'.",
W014: "Bad line breaking before '{a}'.",
W015: "Expected '{a}' to have an indentation at {b} instead at {c}.",
W016: "Unexpected use of '{a}'.",
W017: "Bad operand.",
W018: "Confusing use of '{a}'.",
W019: "Use the isNaN function to compare with NaN.",
W020: "Read only.",
W021: "'{a}' is a function.",
W022: "Do not assign to the exception parameter.",
W023: "Expected an identifier in an assignment and instead saw a function invocation.",
W024: "Expected an identifier and instead saw '{a}' (a reserved word).",
W025: "Missing name in function declaration.",
W026: "Inner functions should be listed at the top of the outer function.",
W027: "Unreachable '{a}' after '{b}'.",
W028: "Label '{a}' on {b} statement.",
W030: "Expected an assignment or function call and instead saw an expression.",
W031: "Do not use 'new' for side effects.",
W032: "Unnecessary semicolon.",
W033: "Missing semicolon.",
W034: "Unnecessary directive \"{a}\".",
W035: "Empty block.",
W036: "Unexpected /*member '{a}'.",
W037: "'{a}' is a statement label.",
W038: "'{a}' used out of scope.",
W039: "'{a}' is not allowed.",
W040: "Possible strict violation.",
W041: "Use '{a}' to compare with '{b}'.",
W042: "Avoid EOL escaping.",
W043: "Bad escaping of EOL. Use option multistr if needed.",
W044: "Bad or unnecessary escaping.",
W045: "Bad number '{a}'.",
W046: "Don't use extra leading zeros '{a}'.",
W047: "A trailing decimal point can be confused with a dot: '{a}'.",
W048: "Unexpected control character in regular expression.",
W049: "Unexpected escaped character '{a}' in regular expression.",
W050: "JavaScript URL.",
W051: "Variables should not be deleted.",
W052: "Unexpected '{a}'.",
W053: "Do not use {a} as a constructor.",
W054: "The Function constructor is a form of eval.",
W055: "A constructor name should start with an uppercase letter.",
W056: "Bad constructor.",
W057: "Weird construction. Is 'new' necessary?",
W058: "Missing '()' invoking a constructor.",
W059: "Avoid arguments.{a}.",
W060: "document.write can be a form of eval.",
W061: "eval can be harmful.",
W062: "Wrap an immediate function invocation in parens " +
"to assist the reader in understanding that the expression " +
"is the result of a function, and not the function itself.",
W063: "Math is not a function.",
W064: "Missing 'new' prefix when invoking a constructor.",
W065: "Missing radix parameter.",
W066: "Implied eval. Consider passing a function instead of a string.",
W067: "Bad invocation.",
W068: "Wrapping non-IIFE function literals in parens is unnecessary.",
W069: "['{a}'] is better written in dot notation.",
W070: "Extra comma. (it breaks older versions of IE)",
W071: "This function has too many statements. ({a})",
W072: "This function has too many parameters. ({a})",
W073: "Blocks are nested too deeply. ({a})",
W074: "This function's cyclomatic complexity is too high. ({a})",
W075: "Duplicate key '{a}'.",
W076: "Unexpected parameter '{a}' in get {b} function.",
W077: "Expected a single parameter in set {a} function.",
W078: "Setter is defined without getter.",
W079: "Redefinition of '{a}'.",
W080: "It's not necessary to initialize '{a}' to 'undefined'.",
W081: "Too many var statements.",
W082: "Function declarations should not be placed in blocks. " +
"Use a function expression or move the statement to the top of " +
"the outer function.",
W083: "Don't make functions within a loop.",
W084: "Expected a conditional expression and instead saw an assignment.",
W085: "Don't use 'with'.",
W086: "Expected a 'break' statement before '{a}'.",
W087: "Forgotten 'debugger' statement?",
W088: "Creating global 'for' variable. Should be 'for (var {a} ...'.",
W089: "The body of a for in should be wrapped in an if statement to filter " +
"unwanted properties from the prototype.",
W090: "'{a}' is not a statement label.",
W091: "'{a}' is out of scope.",
W093: "Did you mean to return a conditional instead of an assignment?",
W094: "Unexpected comma.",
W095: "Expected a string and instead saw {a}.",
W096: "The '{a}' key may produce unexpected results.",
W097: "Use the function form of \"use strict\".",
W098: "'{a}' is defined but never used.",
W099: "Mixed spaces and tabs.",
W100: "This character may get silently deleted by one or more browsers.",
W101: "Line is too long.",
W102: "Trailing whitespace.",
W103: "The '{a}' property is deprecated.",
W104: "'{a}' is only available in JavaScript 1.7.",
W105: "Unexpected {a} in '{b}'.",
W106: "Identifier '{a}' is not in camel case.",
W107: "Script URL.",
W108: "Strings must use doublequote.",
W109: "Strings must use singlequote.",
W110: "Mixed double and single quotes.",
W112: "Unclosed string.",
W113: "Control character in string: {a}.",
W114: "Avoid {a}.",
W115: "Octal literals are not allowed in strict mode.",
W116: "Expected '{a}' and instead saw '{b}'.",
W117: "'{a}' is not defined.",
W118: "'{a}' is only available in Mozilla JavaScript extensions (use moz option).",
W119: "'{a}' is only available in ES6 (use esnext option).",
W120: "You might be leaking a variable ({a}) here.",
W121: "Extending prototype of native object: '{a}'.",
W122: "Invalid typeof value '{a}'",
W123: "'{a}' is already defined in outer scope.",
W124: "A generator function shall contain a yield statement."
W001: "'hasOwnProperty' is a really bad name.",
W002: "Value of '{a}' may be overwritten in IE 8 and earlier.",
W003: "'{a}' was used before it was defined.",
W004: "'{a}' is already defined.",
W005: "A dot following a number can be confused with a decimal point.",
W006: "Confusing minuses.",
W007: "Confusing pluses.",
W008: "A leading decimal point can be confused with a dot: '{a}'.",
W009: "The array literal notation [] is preferable.",
W010: "The object literal notation {} is preferable.",
W011: "Unexpected space after '{a}'.",
W012: "Unexpected space before '{a}'.",
W013: "Missing space after '{a}'.",
W014: "Bad line breaking before '{a}'.",
W015: "Expected '{a}' to have an indentation at {b} instead at {c}.",
W016: "Unexpected use of '{a}'.",
W017: "Bad operand.",
W018: "Confusing use of '{a}'.",
W019: "Use the isNaN function to compare with NaN.",
W020: "Read only.",
W021: "'{a}' is a function.",
W022: "Do not assign to the exception parameter.",
W023: "Expected an identifier in an assignment and instead saw a function invocation.",
W024: "Expected an identifier and instead saw '{a}' (a reserved word).",
W025: "Missing name in function declaration.",
W026: "Inner functions should be listed at the top of the outer function.",
W027: "Unreachable '{a}' after '{b}'.",
W028: "Label '{a}' on {b} statement.",
W030: "Expected an assignment or function call and instead saw an expression.",
W031: "Do not use 'new' for side effects.",
W032: "Unnecessary semicolon.",
W033: "Missing semicolon.",
W034: "Unnecessary directive \"{a}\".",
W035: "Empty block.",
W036: "Unexpected /*member '{a}'.",
W037: "'{a}' is a statement label.",
W038: "'{a}' used out of scope.",
W039: "'{a}' is not allowed.",
W040: "Possible strict violation.",
W041: "Use '{a}' to compare with '{b}'.",
W042: "Avoid EOL escaping.",
W043: "Bad escaping of EOL. Use option multistr if needed.",
W044: "Bad or unnecessary escaping.",
W045: "Bad number '{a}'.",
W046: "Don't use extra leading zeros '{a}'.",
W047: "A trailing decimal point can be confused with a dot: '{a}'.",
W048: "Unexpected control character in regular expression.",
W049: "Unexpected escaped character '{a}' in regular expression.",
W050: "JavaScript URL.",
W051: "Variables should not be deleted.",
W052: "Unexpected '{a}'.",
W053: "Do not use {a} as a constructor.",
W054: "The Function constructor is a form of eval.",
W055: "A constructor name should start with an uppercase letter.",
W056: "Bad constructor.",
W057: "Weird construction. Is 'new' necessary?",
W058: "Missing '()' invoking a constructor.",
W059: "Avoid arguments.{a}.",
W060: "document.write can be a form of eval.",
W061: "eval can be harmful.",
W062: "Wrap an immediate function invocation in parens " +
"to assist the reader in understanding that the expression " +
"is the result of a function, and not the function itself.",
W063: "Math is not a function.",
W064: "Missing 'new' prefix when invoking a constructor.",
W065: "Missing radix parameter.",
W066: "Implied eval. Consider passing a function instead of a string.",
W067: "Bad invocation.",
W068: "Wrapping non-IIFE function literals in parens is unnecessary.",
W069: "['{a}'] is better written in dot notation.",
W070: "Extra comma. (it breaks older versions of IE)",
W071: "This function has too many statements. ({a})",
W072: "This function has too many parameters. ({a})",
W073: "Blocks are nested too deeply. ({a})",
W074: "This function's cyclomatic complexity is too high. ({a})",
W075: "Duplicate key '{a}'.",
W076: "Unexpected parameter '{a}' in get {b} function.",
W077: "Expected a single parameter in set {a} function.",
W078: "Setter is defined without getter.",
W079: "Redefinition of '{a}'.",
W080: "It's not necessary to initialize '{a}' to 'undefined'.",
W081: "Too many var statements.",
W082: "Function declarations should not be placed in blocks. " +
"Use a function expression or move the statement to the top of " +
"the outer function.",
W083: "Don't make functions within a loop.",
W084: "Expected a conditional expression and instead saw an assignment.",
W085: "Don't use 'with'.",
W086: "Expected a 'break' statement before '{a}'.",
W087: "Forgotten 'debugger' statement?",
W088: "Creating global 'for' variable. Should be 'for (var {a} ...'.",
W089: "The body of a for in should be wrapped in an if statement to filter " +
"unwanted properties from the prototype.",
W090: "'{a}' is not a statement label.",
W091: "'{a}' is out of scope.",
W093: "Did you mean to return a conditional instead of an assignment?",
W094: "Unexpected comma.",
W095: "Expected a string and instead saw {a}.",
W096: "The '{a}' key may produce unexpected results.",
W097: "Use the function form of \"use strict\".",
W098: "'{a}' is defined but never used.",
W099: "Mixed spaces and tabs.",
W100: "This character may get silently deleted by one or more browsers.",
W101: "Line is too long.",
W102: "Trailing whitespace.",
W103: "The '{a}' property is deprecated.",
W104: "'{a}' is available in ES6 (use esnext option) or Mozilla JS extensions (use moz).",
W105: "Unexpected {a} in '{b}'.",
W106: "Identifier '{a}' is not in camel case.",
W107: "Script URL.",
W108: "Strings must use doublequote.",
W109: "Strings must use singlequote.",
W110: "Mixed double and single quotes.",
W112: "Unclosed string.",
W113: "Control character in string: {a}.",
W114: "Avoid {a}.",
W115: "Octal literals are not allowed in strict mode.",
W116: "Expected '{a}' and instead saw '{b}'.",
W117: "'{a}' is not defined.",
W118: "'{a}' is only available in Mozilla JavaScript extensions (use moz option).",
W119: "'{a}' is only available in ES6 (use esnext option).",
W120: "You might be leaking a variable ({a}) here.",
W121: "Extending prototype of native object: '{a}'.",
W122: "Invalid typeof value '{a}'",
W123: "'{a}' is already defined in outer scope.",
W124: "A generator function shall contain a yield statement.",
W125: "This line contains non-breaking spaces: http://jshint.com/doc/options/#nonbsp"
};
var info = {
I001: "Comma warnings can be turned off with 'laxcomma'.",
I002: "Reserved words as properties can be used under the 'es5' option.",
I003: "ES5 option is now set per default"
I001: "Comma warnings can be turned off with 'laxcomma'.",
I002: "Reserved words as properties can be used under the 'es5' option.",
I003: "ES5 option is now set per default"
};

@@ -213,11 +214,11 @@

_.each(errors, function (desc, code) {
exports.errors[code] = { code: code, desc: desc };
exports.errors[code] = { code: code, desc: desc };
});
_.each(warnings, function (desc, code) {
exports.warnings[code] = { code: code, desc: desc };
exports.warnings[code] = { code: code, desc: desc };
});
_.each(info, function (desc, code) {
exports.info[code] = { code: code, desc: desc };
exports.info[code] = { code: code, desc: desc };
});

@@ -5,110 +5,110 @@ /*jshint boss: true, rhino: true, unused: true, undef: true, white: true, quotmark: double */

(function (args) {
"use strict";
"use strict";
var filenames = [];
var flags = {};
var optstr; // arg1=val1,arg2=val2,...
var predef; // global1=true,global2,global3,...
var opts = {};
var globals = {};
var retval = 0;
var filenames = [];
var flags = {};
var optstr; // arg1=val1,arg2=val2,...
var predef; // global1=true,global2,global3,...
var opts = {};
var globals = {};
var retval = 0;
args.forEach(function (arg) {
if (arg.indexOf("--") === 0) {
// Configuration Flags might be boolean or will be split into name and value
if (arg.indexOf("=") > -1) {
var o = arg.split("=");
flags[o[0].slice(2)] = o[1];
} else {
flags[arg.slice(2)] = true;
}
args.forEach(function (arg) {
if (arg.indexOf("--") === 0) {
// Configuration Flags might be boolean or will be split into name and value
if (arg.indexOf("=") > -1) {
var o = arg.split("=");
flags[o[0].slice(2)] = o[1];
} else {
flags[arg.slice(2)] = true;
}
return;
} else if (arg.indexOf("=") > -1) {
// usual rhino configuration, like "boss=true,browser=true"
if (!optstr) {
// First time it's the options.
optstr = arg;
} else {
predef = arg;
}
return;
} else if (arg.indexOf("=") > -1) {
// usual rhino configuration, like "boss=true,browser=true"
if (!optstr) {
// First time it's the options.
optstr = arg;
} else {
predef = arg;
}
return;
}
return;
}
if (optstr) {
predef = arg;
return;
}
if (optstr) {
predef = arg;
return;
}
filenames.push(arg);
});
filenames.push(arg);
});
if (filenames.length === 0) {
print("Usage: jshint.js file.js");
quit(1);
}
if (filenames.length === 0) {
print("Usage: jshint.js file.js");
quit(1);
}
// If a config flag has been provided, try and load that
if ("config" in flags) {
var cfgFileContent;
try {
cfgFileContent = readFile(flags.config);
} catch (e) {
print("Could not read config file " + flags.config);
quit(1);
}
// If a config flag has been provided, try and load that
if ("config" in flags) {
var cfgFileContent;
try {
cfgFileContent = readFile(flags.config);
} catch (e) {
print("Could not read config file " + flags.config);
quit(1);
}
opts = JSON.parse(cfgFileContent);
}
opts = JSON.parse(cfgFileContent);
}
if (optstr) {
optstr.split(",").forEach(function (arg) {
var o = arg.split("=");
if (o[0] === "indent") {
opts[o[0]] = parseInt(o[1], 10);
} else {
opts[o[0]] = (function (ov) {
switch (ov) {
case "true":
return true;
case "false":
return false;
default:
return ov;
}
}(o[1]));
}
});
}
if (optstr) {
optstr.split(",").forEach(function (arg) {
var o = arg.split("=");
if (o[0] === "indent") {
opts[o[0]] = parseInt(o[1], 10);
} else {
opts[o[0]] = (function (ov) {
switch (ov) {
case "true":
return true;
case "false":
return false;
default:
return ov;
}
}(o[1]));
}
});
}
globals = opts.globals || {};
delete(opts.globals);
globals = opts.globals || {};
delete(opts.globals);
if (predef) {
predef.split(",").forEach(function (arg) {
var global = arg.split("=");
globals[global[0]] = global[1] === "true" ? true : false;
});
}
if (predef) {
predef.split(",").forEach(function (arg) {
var global = arg.split("=");
globals[global[0]] = global[1] === "true" ? true : false;
});
}
filenames.forEach(function (name) {
var input = readFile(name);
filenames.forEach(function (name) {
var input = readFile(name);
if (!input) {
print("jshint: Couldn't open file " + name);
quit(1);
}
if (!input) {
print("jshint: Couldn't open file " + name);
quit(1);
}
if (!JSHINT(input, opts, globals)) {
for (var i = 0, err; err = JSHINT.errors[i]; i += 1) {
print(err.reason + " (" + name + ":" + err.line + ":" + err.character + ")");
print("> " + (err.evidence || "").replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1"));
print("");
}
retval = 2;
}
});
if (!JSHINT(input, opts, globals)) {
for (var i = 0, err; err = JSHINT.errors[i]; i += 1) {
print(err.reason + " (" + name + ":" + err.line + ":" + err.character + ")");
print("> " + (err.evidence || "").replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1"));
print("");
}
retval = 2;
}
});
quit(retval);
quit(retval);
}(arguments));

@@ -11,14 +11,14 @@ /*

exports.unsafeString =
/@cc|<\/?|script|\]\s*\]|<\s*!|&lt/i;
/@cc|<\/?|script|\]\s*\]|<\s*!|&lt/i;
// Unsafe characters that are silently deleted by one or more browsers (cx)
exports.unsafeChars =
/[\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/;
/[\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/;
// Characters in strings that need escaping (nx and nxg)
exports.needEsc =
/[\u0000-\u001f&<"\/\\\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/;
/[\u0000-\u001f&<"\/\\\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/;
exports.needEscGlobal =
/[\u0000-\u001f&<"\/\\\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
/[\u0000-\u001f&<"\/\\\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;

@@ -25,0 +25,0 @@ // Star slash (lx)

@@ -5,78 +5,78 @@ // Author: Boy Baukema

{
reporter: function (results, data, opts)
{
"use strict";
reporter: function (results, data, opts)
{
"use strict";
var files = {},
out = [],
pairs = {
"&": "&amp;",
'"': "&quot;",
"'": "&apos;",
"<": "&lt;",
">": "&gt;"
},
fileName, i, issue, errorMessage;
var files = {},
out = [],
pairs = {
"&": "&amp;",
'"': "&quot;",
"'": "&apos;",
"<": "&lt;",
">": "&gt;"
},
fileName, i, issue, errorMessage;
opts = opts || {};
opts = opts || {};
function encode(s) {
for (var r in pairs) {
if (typeof(s) !== "undefined") {
s = s.replace(new RegExp(r, "g"), pairs[r]);
}
}
return s || "";
}
function encode(s) {
for (var r in pairs) {
if (typeof(s) !== "undefined") {
s = s.replace(new RegExp(r, "g"), pairs[r]);
}
}
return s || "";
}
results.forEach(function (result) {
// Register the file
result.file = result.file.replace(/^\.\//, '');
if (!files[result.file]) {
files[result.file] = [];
}
results.forEach(function (result) {
// Register the file
result.file = result.file.replace(/^\.\//, '');
if (!files[result.file]) {
files[result.file] = [];
}
// Create the error message
errorMessage = result.error.reason;
if (opts.verbose) {
errorMessage += ' (' + result.error.code + ')';
}
// Create the error message
errorMessage = result.error.reason;
if (opts.verbose) {
errorMessage += ' (' + result.error.code + ')';
}
// Add the error
files[result.file].push({
severity: 'error',
line: result.error.line,
column: result.error.character,
message: errorMessage,
source: 'jshint.' + result.error.code
});
});
// Add the error
files[result.file].push({
severity: 'error',
line: result.error.line,
column: result.error.character,
message: errorMessage,
source: 'jshint.' + result.error.code
});
});
out.push("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
out.push("<checkstyle version=\"4.3\">");
out.push("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
out.push("<checkstyle version=\"4.3\">");
for (fileName in files) {
if (files.hasOwnProperty(fileName)) {
out.push("\t<file name=\"" + fileName + "\">");
for (i = 0; i < files[fileName].length; i++) {
issue = files[fileName][i];
out.push(
"\t\t<error " +
"line=\"" + issue.line + "\" " +
"column=\"" + issue.column + "\" " +
"severity=\"" + issue.severity + "\" " +
"message=\"" + encode(issue.message) + "\" " +
"source=\"" + encode(issue.source) + "\" " +
"/>"
);
}
out.push("\t</file>");
}
}
for (fileName in files) {
if (files.hasOwnProperty(fileName)) {
out.push("\t<file name=\"" + fileName + "\">");
for (i = 0; i < files[fileName].length; i++) {
issue = files[fileName][i];
out.push(
"\t\t<error " +
"line=\"" + issue.line + "\" " +
"column=\"" + issue.column + "\" " +
"severity=\"" + issue.severity + "\" " +
"message=\"" + encode(issue.message) + "\" " +
"source=\"" + encode(issue.source) + "\" " +
"/>"
);
}
out.push("\t</file>");
}
}
out.push("</checkstyle>");
out.push("</checkstyle>");
process.stdout.write(out.join("\n") + "\n");
}
process.stdout.write(out.join("\n") + "\n");
}
};
"use strict";
module.exports = {
reporter: function (results, data, opts) {
var len = results.length;
var str = '';
var prevfile;
reporter: function (results, data, opts) {
var len = results.length;
var str = '';
var prevfile;
opts = opts || {};
opts = opts || {};
results.forEach(function (result) {
var file = result.file;
var error = result.error;
results.forEach(function (result) {
var file = result.file;
var error = result.error;
if (prevfile && prevfile !== file) {
str += "\n";
}
prevfile = file;
if (prevfile && prevfile !== file) {
str += "\n";
}
prevfile = file;
str += file + ': line ' + error.line + ', col ' +
error.character + ', ' + error.reason;
str += file + ': line ' + error.line + ', col ' +
error.character + ', ' + error.reason;
if (opts.verbose) {
str += ' (' + error.code + ')';
}
if (opts.verbose) {
str += ' (' + error.code + ')';
}
str += '\n';
});
str += '\n';
});
if (str) {
process.stdout.write(str + "\n" + len + ' error' + ((len === 1) ? '' : 's') + "\n");
}
}
if (str) {
process.stdout.write(str + "\n" + len + ' error' + ((len === 1) ? '' : 's') + "\n");
}
}
};
module.exports =
{
reporter: function (results)
{
"use strict";
reporter: function (results)
{
"use strict";
var files = {},
out = [],
pairs = {
"&": "&amp;",
'"': "&quot;",
"'": "&apos;",
"<": "&lt;",
">": "&gt;"
},
file, i, issue;
var files = {},
out = [],
pairs = {
"&": "&amp;",
'"': "&quot;",
"'": "&apos;",
"<": "&lt;",
">": "&gt;"
},
file, i, issue;
function encode(s) {
for (var r in pairs) {
if (typeof(s) !== "undefined") {
s = s.replace(new RegExp(r, "g"), pairs[r]);
}
}
return s || "";
}
function encode(s) {
for (var r in pairs) {
if (typeof(s) !== "undefined") {
s = s.replace(new RegExp(r, "g"), pairs[r]);
}
}
return s || "";
}
results.forEach(function (result) {
result.file = result.file.replace(/^\.\//, '');
if (!files[result.file]) {
files[result.file] = [];
}
files[result.file].push(result.error);
});
results.forEach(function (result) {
result.file = result.file.replace(/^\.\//, '');
if (!files[result.file]) {
files[result.file] = [];
}
files[result.file].push(result.error);
});
out.push("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
out.push("<jslint>");
out.push("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
out.push("<jslint>");
for (file in files) {
out.push("\t<file name=\"" + file + "\">");
for (i = 0; i < files[file].length; i++) {
issue = files[file][i];
out.push("\t\t<issue line=\"" + issue.line +
"\" char=\"" + issue.character +
"\" reason=\"" + encode(issue.reason) +
"\" evidence=\"" + encode(issue.evidence) +
(issue.code ? "\" severity=\"" + encode(issue.code.charAt(0)) : "") +
"\" />");
}
out.push("\t</file>");
}
for (file in files) {
out.push("\t<file name=\"" + file + "\">");
for (i = 0; i < files[file].length; i++) {
issue = files[file][i];
out.push("\t\t<issue line=\"" + issue.line +
"\" char=\"" + issue.character +
"\" reason=\"" + encode(issue.reason) +
"\" evidence=\"" + encode(issue.evidence) +
(issue.code ? "\" severity=\"" + encode(issue.code.charAt(0)) : "") +
"\" />");
}
out.push("\t</file>");
}
out.push("</jslint>");
out.push("</jslint>");
process.stdout.write(out.join("\n") + "\n");
}
process.stdout.write(out.join("\n") + "\n");
}
};
"use strict";
module.exports = {
reporter: function (results, data, opts) {
var len = results.length,
str = '',
file, error, globals, unuseds;
reporter: function (results, data, opts) {
var len = results.length,
str = '',
file, error, globals, unuseds;
results.forEach(function (result) {
file = result.file;
error = result.error;
str += file + ': line ' + error.line + ', col ' +
error.character + ', ' + error.reason;
results.forEach(function (result) {
file = result.file;
error = result.error;
str += file + ': line ' + error.line + ', col ' +
error.character + ', ' + error.reason;
// Add the error code if the --verbose option is set
if (opts.verbose) {
str += ' (' + error.code + ')';
}
// Add the error code if the --verbose option is set
if (opts.verbose) {
str += ' (' + error.code + ')';
}
str += '\n';
});
str += '\n';
});
str += len > 0 ? ("\n" + len + ' error' + ((len === 1) ? '' : 's')) : "";
str += len > 0 ? ("\n" + len + ' error' + ((len === 1) ? '' : 's')) : "";
data.forEach(function (data) {
file = data.file;
globals = data.implieds;
unuseds = data.unused;
data.forEach(function (data) {
file = data.file;
globals = data.implieds;
unuseds = data.unused;
if (globals || unuseds) {
str += '\n\n' + file + ' :\n';
}
if (globals || unuseds) {
str += '\n\n' + file + ' :\n';
}
if (globals) {
str += '\tImplied globals:\n';
globals.forEach(function (global) {
str += '\t\t' + global.name + ': ' + global.line + '\n';
});
}
if (unuseds) {
str += '\tUnused Variables:\n\t\t';
unuseds.forEach(function (unused) {
str += unused.name + '(' + unused.line + '), ';
});
}
});
if (globals) {
str += '\tImplied globals:\n';
globals.forEach(function (global) {
str += '\t\t' + global.name + ': ' + global.line + '\n';
});
}
if (unuseds) {
str += '\tUnused Variables:\n\t\t';
unuseds.forEach(function (unused) {
str += unused.name + '(' + unused.line + '), ';
});
}
});
if (str) {
process.stdout.write(str + "\n");
}
}
if (str) {
process.stdout.write(str + "\n");
}
}
};
"use strict";
var state = {
syntax: {},
syntax: {},
reset: function () {
this.tokens = {
prev: null,
next: null,
curr: null
};
reset: function () {
this.tokens = {
prev: null,
next: null,
curr: null
};
this.option = {};
this.ignored = {};
this.directive = {};
this.jsonMode = false;
this.jsonWarnings = [];
this.lines = [];
this.tab = "";
this.cache = {}; // Node.JS doesn't have Map. Sniff.
this.ignoreLinterErrors = false; // Blank out non-multi-line-commented
// lines when ignoring linter errors
}
this.option = {};
this.ignored = {};
this.directive = {};
this.jsonMode = false;
this.jsonWarnings = [];
this.lines = [];
this.tab = "";
this.cache = {}; // Node.JS doesn't have Map. Sniff.
this.ignoreLinterErrors = false; // Blank out non-multi-line-commented
// lines when ignoring linter errors
}
};
exports.state = state;
"use strict";
exports.register = function (linter) {
// Check for properties named __proto__. This special property was
// deprecated and then re-introduced for ES6.
// Check for properties named __proto__. This special property was
// deprecated and then re-introduced for ES6.
linter.on("Identifier", function style_scanProto(data) {
if (linter.getOption("proto")) {
return;
}
linter.on("Identifier", function style_scanProto(data) {
if (linter.getOption("proto")) {
return;
}
if (data.name === "__proto__") {
linter.warn("W103", {
line: data.line,
char: data.char,
data: [ data.name ]
});
}
});
if (data.name === "__proto__") {
linter.warn("W103", {
line: data.line,
char: data.char,
data: [ data.name ]
});
}
});
// Check for properties named __iterator__. This is a special property
// available only in browsers with JavaScript 1.7 implementation.
// Check for properties named __iterator__. This is a special property
// available only in browsers with JavaScript 1.7 implementation.
linter.on("Identifier", function style_scanIterator(data) {
if (linter.getOption("iterator")) {
return;
}
linter.on("Identifier", function style_scanIterator(data) {
if (linter.getOption("iterator")) {
return;
}
if (data.name === "__iterator__") {
linter.warn("W104", {
line: data.line,
char: data.char,
data: [ data.name ]
});
}
});
if (data.name === "__iterator__") {
linter.warn("W104", {
line: data.line,
char: data.char,
data: [ data.name ]
});
}
});
// Check for dangling underscores.
// Check for dangling underscores.
linter.on("Identifier", function style_scanDangling(data) {
if (!linter.getOption("nomen")) {
return;
}
linter.on("Identifier", function style_scanDangling(data) {
if (!linter.getOption("nomen")) {
return;
}
// Underscore.js
if (data.name === "_") {
return;
}
// Underscore.js
if (data.name === "_") {
return;
}
// In Node, __dirname and __filename should be ignored.
if (linter.getOption("node")) {
if (/^(__dirname|__filename)$/.test(data.name) && !data.isProperty) {
return;
}
}
// In Node, __dirname and __filename should be ignored.
if (linter.getOption("node")) {
if (/^(__dirname|__filename)$/.test(data.name) && !data.isProperty) {
return;
}
}
if (/^(_+.*|.*_+)$/.test(data.name)) {
linter.warn("W105", {
line: data.line,
char: data.from,
data: [ "dangling '_'", data.name ]
});
}
});
if (/^(_+.*|.*_+)$/.test(data.name)) {
linter.warn("W105", {
line: data.line,
char: data.from,
data: [ "dangling '_'", data.name ]
});
}
});
// Check that all identifiers are using camelCase notation.
// Exceptions: names like MY_VAR and _myVar.
// Check that all identifiers are using camelCase notation.
// Exceptions: names like MY_VAR and _myVar.
linter.on("Identifier", function style_scanCamelCase(data) {
if (!linter.getOption("camelcase")) {
return;
}
linter.on("Identifier", function style_scanCamelCase(data) {
if (!linter.getOption("camelcase")) {
return;
}
if (data.name.replace(/^_+|_+$/g, "").indexOf("_") > -1 && !data.name.match(/^[A-Z0-9_]*$/)) {
linter.warn("W106", {
line: data.line,
char: data.from,
data: [ data.name ]
});
}
});
if (data.name.replace(/^_+|_+$/g, "").indexOf("_") > -1 && !data.name.match(/^[A-Z0-9_]*$/)) {
linter.warn("W106", {
line: data.line,
char: data.from,
data: [ data.name ]
});
}
});
// Enforce consistency in style of quoting.
// Enforce consistency in style of quoting.
linter.on("String", function style_scanQuotes(data) {
var quotmark = linter.getOption("quotmark");
var code;
linter.on("String", function style_scanQuotes(data) {
var quotmark = linter.getOption("quotmark");
var code;
if (!quotmark) {
return;
}
if (!quotmark) {
return;
}
// If quotmark is set to 'single' warn about all double-quotes.
// If quotmark is set to 'single' warn about all double-quotes.
if (quotmark === "single" && data.quote !== "'") {
code = "W109";
}
if (quotmark === "single" && data.quote !== "'") {
code = "W109";
}
// If quotmark is set to 'double' warn about all single-quotes.
// If quotmark is set to 'double' warn about all single-quotes.
if (quotmark === "double" && data.quote !== "\"") {
code = "W108";
}
if (quotmark === "double" && data.quote !== "\"") {
code = "W108";
}
// If quotmark is set to true, remember the first quotation style
// and then warn about all others.
// If quotmark is set to true, remember the first quotation style
// and then warn about all others.
if (quotmark === true) {
if (!linter.getCache("quotmark")) {
linter.setCache("quotmark", data.quote);
}
if (quotmark === true) {
if (!linter.getCache("quotmark")) {
linter.setCache("quotmark", data.quote);
}
if (linter.getCache("quotmark") !== data.quote) {
code = "W110";
}
}
if (linter.getCache("quotmark") !== data.quote) {
code = "W110";
}
}
if (code) {
linter.warn(code, {
line: data.line,
char: data.char,
});
}
});
if (code) {
linter.warn(code, {
line: data.line,
char: data.char,
});
}
});
linter.on("Number", function style_scanNumbers(data) {
if (data.value.charAt(0) === ".") {
// Warn about a leading decimal point.
linter.warn("W008", {
line: data.line,
char: data.char,
data: [ data.value ]
});
}
linter.on("Number", function style_scanNumbers(data) {
if (data.value.charAt(0) === ".") {
// Warn about a leading decimal point.
linter.warn("W008", {
line: data.line,
char: data.char,
data: [ data.value ]
});
}
if (data.value.substr(data.value.length - 1) === ".") {
// Warn about a trailing decimal point.
linter.warn("W047", {
line: data.line,
char: data.char,
data: [ data.value ]
});
}
if (data.value.substr(data.value.length - 1) === ".") {
// Warn about a trailing decimal point.
linter.warn("W047", {
line: data.line,
char: data.char,
data: [ data.value ]
});
}
if (/^00+/.test(data.value)) {
// Multiple leading zeroes.
linter.warn("W046", {
line: data.line,
char: data.char,
data: [ data.value ]
});
}
});
if (/^00+/.test(data.value)) {
// Multiple leading zeroes.
linter.warn("W046", {
line: data.line,
char: data.char,
data: [ data.value ]
});
}
});
// Warn about script URLs.
// Warn about script URLs.
linter.on("String", function style_scanJavaScriptURLs(data) {
var re = /^(?:javascript|jscript|ecmascript|vbscript|mocha|livescript)\s*:/i;
linter.on("String", function style_scanJavaScriptURLs(data) {
var re = /^(?:javascript|jscript|ecmascript|vbscript|mocha|livescript)\s*:/i;
if (linter.getOption("scripturl")) {
return;
}
if (linter.getOption("scripturl")) {
return;
}
if (re.test(data.value)) {
linter.warn("W107", {
line: data.line,
char: data.char
});
}
});
if (re.test(data.value)) {
linter.warn("W107", {
line: data.line,
char: data.char
});
}
});
};

@@ -8,37 +8,37 @@ // jshint -W001

exports.reservedVars = {
arguments : false,
NaN : false
arguments : false,
NaN : false
};
exports.ecmaIdentifiers = {
Array : false,
Boolean : false,
Date : false,
decodeURI : false,
decodeURIComponent : false,
encodeURI : false,
encodeURIComponent : false,
Error : false,
"eval" : false,
EvalError : false,
Function : false,
hasOwnProperty : false,
isFinite : false,
isNaN : false,
JSON : false,
Math : false,
Map : false,
Number : false,
Object : false,
parseInt : false,
parseFloat : false,
RangeError : false,
ReferenceError : false,
RegExp : false,
Set : false,
String : false,
SyntaxError : false,
TypeError : false,
URIError : false,
WeakMap : false
Array : false,
Boolean : false,
Date : false,
decodeURI : false,
decodeURIComponent : false,
encodeURI : false,
encodeURIComponent : false,
Error : false,
"eval" : false,
EvalError : false,
Function : false,
hasOwnProperty : false,
isFinite : false,
isNaN : false,
JSON : false,
Math : false,
Map : false,
Number : false,
Object : false,
parseInt : false,
parseFloat : false,
RangeError : false,
ReferenceError : false,
RegExp : false,
Set : false,
String : false,
SyntaxError : false,
TypeError : false,
URIError : false,
WeakMap : false
};

@@ -49,308 +49,308 @@

exports.browser = {
Audio : false,
Blob : false,
addEventListener : false,
applicationCache : false,
atob : false,
blur : false,
btoa : false,
CanvasGradient : false,
CanvasPattern : false,
CanvasRenderingContext2D: false,
clearInterval : false,
clearTimeout : false,
close : false,
closed : false,
CustomEvent : false,
DOMParser : false,
defaultStatus : false,
document : false,
Element : false,
ElementTimeControl : false,
event : false,
FileReader : false,
FormData : false,
focus : false,
frames : false,
getComputedStyle : false,
HTMLElement : false,
HTMLAnchorElement : false,
HTMLBaseElement : false,
HTMLBlockquoteElement: false,
HTMLBodyElement : false,
HTMLBRElement : false,
HTMLButtonElement : false,
HTMLCanvasElement : false,
HTMLDirectoryElement : false,
HTMLDivElement : false,
HTMLDListElement : false,
HTMLFieldSetElement : false,
HTMLFontElement : false,
HTMLFormElement : false,
HTMLFrameElement : false,
HTMLFrameSetElement : false,
HTMLHeadElement : false,
HTMLHeadingElement : false,
HTMLHRElement : false,
HTMLHtmlElement : false,
HTMLIFrameElement : false,
HTMLImageElement : false,
HTMLInputElement : false,
HTMLIsIndexElement : false,
HTMLLabelElement : false,
HTMLLayerElement : false,
HTMLLegendElement : false,
HTMLLIElement : false,
HTMLLinkElement : false,
HTMLMapElement : false,
HTMLMenuElement : false,
HTMLMetaElement : false,
HTMLModElement : false,
HTMLObjectElement : false,
HTMLOListElement : false,
HTMLOptGroupElement : false,
HTMLOptionElement : false,
HTMLParagraphElement : false,
HTMLParamElement : false,
HTMLPreElement : false,
HTMLQuoteElement : false,
HTMLScriptElement : false,
HTMLSelectElement : false,
HTMLStyleElement : false,
HTMLTableCaptionElement: false,
HTMLTableCellElement : false,
HTMLTableColElement : false,
HTMLTableElement : false,
HTMLTableRowElement : false,
HTMLTableSectionElement: false,
HTMLTextAreaElement : false,
HTMLTitleElement : false,
HTMLUListElement : false,
HTMLVideoElement : false,
history : false,
Image : false,
length : false,
localStorage : false,
location : false,
Audio : false,
Blob : false,
addEventListener : false,
applicationCache : false,
atob : false,
blur : false,
btoa : false,
CanvasGradient : false,
CanvasPattern : false,
CanvasRenderingContext2D: false,
clearInterval : false,
clearTimeout : false,
close : false,
closed : false,
CustomEvent : false,
DOMParser : false,
defaultStatus : false,
document : false,
Element : false,
ElementTimeControl : false,
event : false,
FileReader : false,
FormData : false,
focus : false,
frames : false,
getComputedStyle : false,
HTMLElement : false,
HTMLAnchorElement : false,
HTMLBaseElement : false,
HTMLBlockquoteElement: false,
HTMLBodyElement : false,
HTMLBRElement : false,
HTMLButtonElement : false,
HTMLCanvasElement : false,
HTMLDirectoryElement : false,
HTMLDivElement : false,
HTMLDListElement : false,
HTMLFieldSetElement : false,
HTMLFontElement : false,
HTMLFormElement : false,
HTMLFrameElement : false,
HTMLFrameSetElement : false,
HTMLHeadElement : false,
HTMLHeadingElement : false,
HTMLHRElement : false,
HTMLHtmlElement : false,
HTMLIFrameElement : false,
HTMLImageElement : false,
HTMLInputElement : false,
HTMLIsIndexElement : false,
HTMLLabelElement : false,
HTMLLayerElement : false,
HTMLLegendElement : false,
HTMLLIElement : false,
HTMLLinkElement : false,
HTMLMapElement : false,
HTMLMenuElement : false,
HTMLMetaElement : false,
HTMLModElement : false,
HTMLObjectElement : false,
HTMLOListElement : false,
HTMLOptGroupElement : false,
HTMLOptionElement : false,
HTMLParagraphElement : false,
HTMLParamElement : false,
HTMLPreElement : false,
HTMLQuoteElement : false,
HTMLScriptElement : false,
HTMLSelectElement : false,
HTMLStyleElement : false,
HTMLTableCaptionElement: false,
HTMLTableCellElement : false,
HTMLTableColElement : false,
HTMLTableElement : false,
HTMLTableRowElement : false,
HTMLTableSectionElement: false,
HTMLTextAreaElement : false,
HTMLTitleElement : false,
HTMLUListElement : false,
HTMLVideoElement : false,
history : false,
Image : false,
length : false,
localStorage : false,
location : false,
matchMedia : false,
MessageChannel : false,
MessageEvent : false,
MessagePort : false,
MouseEvent : false,
moveBy : false,
moveTo : false,
MutationObserver : false,
name : false,
Node : false,
NodeFilter : false,
navigator : false,
onbeforeunload : true,
onblur : true,
onerror : true,
onfocus : true,
onload : true,
onresize : true,
onunload : true,
open : false,
openDatabase : false,
opener : false,
Option : false,
parent : false,
print : false,
removeEventListener : false,
resizeBy : false,
resizeTo : false,
screen : false,
scroll : false,
scrollBy : false,
scrollTo : false,
sessionStorage : false,
setInterval : false,
setTimeout : false,
SharedWorker : false,
status : false,
SVGAElement : false,
SVGAltGlyphDefElement: false,
SVGAltGlyphElement : false,
SVGAltGlyphItemElement: false,
SVGAngle : false,
SVGAnimateColorElement: false,
SVGAnimateElement : false,
SVGAnimateMotionElement: false,
SVGAnimateTransformElement: false,
SVGAnimatedAngle : false,
SVGAnimatedBoolean : false,
SVGAnimatedEnumeration: false,
SVGAnimatedInteger : false,
SVGAnimatedLength : false,
SVGAnimatedLengthList: false,
SVGAnimatedNumber : false,
SVGAnimatedNumberList: false,
SVGAnimatedPathData : false,
SVGAnimatedPoints : false,
SVGAnimatedPreserveAspectRatio: false,
SVGAnimatedRect : false,
SVGAnimatedString : false,
SVGAnimatedTransformList: false,
SVGAnimationElement : false,
SVGCSSRule : false,
SVGCircleElement : false,
SVGClipPathElement : false,
SVGColor : false,
SVGColorProfileElement: false,
SVGColorProfileRule : false,
SVGComponentTransferFunctionElement: false,
SVGCursorElement : false,
SVGDefsElement : false,
SVGDescElement : false,
SVGDocument : false,
SVGElement : false,
SVGElementInstance : false,
SVGElementInstanceList: false,
SVGEllipseElement : false,
SVGExternalResourcesRequired: false,
SVGFEBlendElement : false,
SVGFEColorMatrixElement: false,
SVGFEComponentTransferElement: false,
SVGFECompositeElement: false,
SVGFEConvolveMatrixElement: false,
SVGFEDiffuseLightingElement: false,
SVGFEDisplacementMapElement: false,
SVGFEDistantLightElement: false,
SVGFEFloodElement : false,
SVGFEFuncAElement : false,
SVGFEFuncBElement : false,
SVGFEFuncGElement : false,
SVGFEFuncRElement : false,
SVGFEGaussianBlurElement: false,
SVGFEImageElement : false,
SVGFEMergeElement : false,
SVGFEMergeNodeElement: false,
SVGFEMorphologyElement: false,
SVGFEOffsetElement : false,
SVGFEPointLightElement: false,
SVGFESpecularLightingElement: false,
SVGFESpotLightElement: false,
SVGFETileElement : false,
SVGFETurbulenceElement: false,
SVGFilterElement : false,
SVGFilterPrimitiveStandardAttributes: false,
SVGFitToViewBox : false,
SVGFontElement : false,
SVGFontFaceElement : false,
SVGFontFaceFormatElement: false,
SVGFontFaceNameElement: false,
SVGFontFaceSrcElement: false,
SVGFontFaceUriElement: false,
SVGForeignObjectElement: false,
SVGGElement : false,
SVGGlyphElement : false,
SVGGlyphRefElement : false,
SVGGradientElement : false,
SVGHKernElement : false,
SVGICCColor : false,
SVGImageElement : false,
SVGLangSpace : false,
SVGLength : false,
SVGLengthList : false,
SVGLineElement : false,
SVGLinearGradientElement: false,
SVGLocatable : false,
SVGMPathElement : false,
SVGMarkerElement : false,
SVGMaskElement : false,
SVGMatrix : false,
SVGMetadataElement : false,
SVGMissingGlyphElement: false,
SVGNumber : false,
SVGNumberList : false,
SVGPaint : false,
SVGPathElement : false,
SVGPathSeg : false,
SVGPathSegArcAbs : false,
SVGPathSegArcRel : false,
SVGPathSegClosePath : false,
SVGPathSegCurvetoCubicAbs: false,
SVGPathSegCurvetoCubicRel: false,
SVGPathSegCurvetoCubicSmoothAbs: false,
SVGPathSegCurvetoCubicSmoothRel: false,
SVGPathSegCurvetoQuadraticAbs: false,
SVGPathSegCurvetoQuadraticRel: false,
SVGPathSegCurvetoQuadraticSmoothAbs: false,
SVGPathSegCurvetoQuadraticSmoothRel: false,
SVGPathSegLinetoAbs : false,
SVGPathSegLinetoHorizontalAbs: false,
SVGPathSegLinetoHorizontalRel: false,
SVGPathSegLinetoRel : false,
SVGPathSegLinetoVerticalAbs: false,
SVGPathSegLinetoVerticalRel: false,
SVGPathSegList : false,
SVGPathSegMovetoAbs : false,
SVGPathSegMovetoRel : false,
SVGPatternElement : false,
SVGPoint : false,
SVGPointList : false,
SVGPolygonElement : false,
SVGPolylineElement : false,
SVGPreserveAspectRatio: false,
SVGRadialGradientElement: false,
SVGRect : false,
SVGRectElement : false,
SVGRenderingIntent : false,
SVGSVGElement : false,
SVGScriptElement : false,
SVGSetElement : false,
SVGStopElement : false,
SVGStringList : false,
SVGStylable : false,
SVGStyleElement : false,
SVGSwitchElement : false,
SVGSymbolElement : false,
SVGTRefElement : false,
SVGTSpanElement : false,
SVGTests : false,
SVGTextContentElement: false,
SVGTextElement : false,
SVGTextPathElement : false,
SVGTextPositioningElement: false,
SVGTitleElement : false,
SVGTransform : false,
SVGTransformList : false,
SVGTransformable : false,
SVGURIReference : false,
SVGUnitTypes : false,
SVGUseElement : false,
SVGVKernElement : false,
SVGViewElement : false,
SVGViewSpec : false,
SVGZoomAndPan : false,
TimeEvent : false,
top : false,
URL : false,
WebSocket : false,
window : false,
Worker : false,
XMLHttpRequest : false,
XMLSerializer : false,
XPathEvaluator : false,
XPathException : false,
XPathExpression : false,
XPathNamespace : false,
XPathNSResolver : false,
XPathResult : false
MessageChannel : false,
MessageEvent : false,
MessagePort : false,
MouseEvent : false,
moveBy : false,
moveTo : false,
MutationObserver : false,
name : false,
Node : false,
NodeFilter : false,
navigator : false,
onbeforeunload : true,
onblur : true,
onerror : true,
onfocus : true,
onload : true,
onresize : true,
onunload : true,
open : false,
openDatabase : false,
opener : false,
Option : false,
parent : false,
print : false,
removeEventListener : false,
resizeBy : false,
resizeTo : false,
screen : false,
scroll : false,
scrollBy : false,
scrollTo : false,
sessionStorage : false,
setInterval : false,
setTimeout : false,
SharedWorker : false,
status : false,
SVGAElement : false,
SVGAltGlyphDefElement: false,
SVGAltGlyphElement : false,
SVGAltGlyphItemElement: false,
SVGAngle : false,
SVGAnimateColorElement: false,
SVGAnimateElement : false,
SVGAnimateMotionElement: false,
SVGAnimateTransformElement: false,
SVGAnimatedAngle : false,
SVGAnimatedBoolean : false,
SVGAnimatedEnumeration: false,
SVGAnimatedInteger : false,
SVGAnimatedLength : false,
SVGAnimatedLengthList: false,
SVGAnimatedNumber : false,
SVGAnimatedNumberList: false,
SVGAnimatedPathData : false,
SVGAnimatedPoints : false,
SVGAnimatedPreserveAspectRatio: false,
SVGAnimatedRect : false,
SVGAnimatedString : false,
SVGAnimatedTransformList: false,
SVGAnimationElement : false,
SVGCSSRule : false,
SVGCircleElement : false,
SVGClipPathElement : false,
SVGColor : false,
SVGColorProfileElement: false,
SVGColorProfileRule : false,
SVGComponentTransferFunctionElement: false,
SVGCursorElement : false,
SVGDefsElement : false,
SVGDescElement : false,
SVGDocument : false,
SVGElement : false,
SVGElementInstance : false,
SVGElementInstanceList: false,
SVGEllipseElement : false,
SVGExternalResourcesRequired: false,
SVGFEBlendElement : false,
SVGFEColorMatrixElement: false,
SVGFEComponentTransferElement: false,
SVGFECompositeElement: false,
SVGFEConvolveMatrixElement: false,
SVGFEDiffuseLightingElement: false,
SVGFEDisplacementMapElement: false,
SVGFEDistantLightElement: false,
SVGFEFloodElement : false,
SVGFEFuncAElement : false,
SVGFEFuncBElement : false,
SVGFEFuncGElement : false,
SVGFEFuncRElement : false,
SVGFEGaussianBlurElement: false,
SVGFEImageElement : false,
SVGFEMergeElement : false,
SVGFEMergeNodeElement: false,
SVGFEMorphologyElement: false,
SVGFEOffsetElement : false,
SVGFEPointLightElement: false,
SVGFESpecularLightingElement: false,
SVGFESpotLightElement: false,
SVGFETileElement : false,
SVGFETurbulenceElement: false,
SVGFilterElement : false,
SVGFilterPrimitiveStandardAttributes: false,
SVGFitToViewBox : false,
SVGFontElement : false,
SVGFontFaceElement : false,
SVGFontFaceFormatElement: false,
SVGFontFaceNameElement: false,
SVGFontFaceSrcElement: false,
SVGFontFaceUriElement: false,
SVGForeignObjectElement: false,
SVGGElement : false,
SVGGlyphElement : false,
SVGGlyphRefElement : false,
SVGGradientElement : false,
SVGHKernElement : false,
SVGICCColor : false,
SVGImageElement : false,
SVGLangSpace : false,
SVGLength : false,
SVGLengthList : false,
SVGLineElement : false,
SVGLinearGradientElement: false,
SVGLocatable : false,
SVGMPathElement : false,
SVGMarkerElement : false,
SVGMaskElement : false,
SVGMatrix : false,
SVGMetadataElement : false,
SVGMissingGlyphElement: false,
SVGNumber : false,
SVGNumberList : false,
SVGPaint : false,
SVGPathElement : false,
SVGPathSeg : false,
SVGPathSegArcAbs : false,
SVGPathSegArcRel : false,
SVGPathSegClosePath : false,
SVGPathSegCurvetoCubicAbs: false,
SVGPathSegCurvetoCubicRel: false,
SVGPathSegCurvetoCubicSmoothAbs: false,
SVGPathSegCurvetoCubicSmoothRel: false,
SVGPathSegCurvetoQuadraticAbs: false,
SVGPathSegCurvetoQuadraticRel: false,
SVGPathSegCurvetoQuadraticSmoothAbs: false,
SVGPathSegCurvetoQuadraticSmoothRel: false,
SVGPathSegLinetoAbs : false,
SVGPathSegLinetoHorizontalAbs: false,
SVGPathSegLinetoHorizontalRel: false,
SVGPathSegLinetoRel : false,
SVGPathSegLinetoVerticalAbs: false,
SVGPathSegLinetoVerticalRel: false,
SVGPathSegList : false,
SVGPathSegMovetoAbs : false,
SVGPathSegMovetoRel : false,
SVGPatternElement : false,
SVGPoint : false,
SVGPointList : false,
SVGPolygonElement : false,
SVGPolylineElement : false,
SVGPreserveAspectRatio: false,
SVGRadialGradientElement: false,
SVGRect : false,
SVGRectElement : false,
SVGRenderingIntent : false,
SVGSVGElement : false,
SVGScriptElement : false,
SVGSetElement : false,
SVGStopElement : false,
SVGStringList : false,
SVGStylable : false,
SVGStyleElement : false,
SVGSwitchElement : false,
SVGSymbolElement : false,
SVGTRefElement : false,
SVGTSpanElement : false,
SVGTests : false,
SVGTextContentElement: false,
SVGTextElement : false,
SVGTextPathElement : false,
SVGTextPositioningElement: false,
SVGTitleElement : false,
SVGTransform : false,
SVGTransformList : false,
SVGTransformable : false,
SVGURIReference : false,
SVGUnitTypes : false,
SVGUseElement : false,
SVGVKernElement : false,
SVGViewElement : false,
SVGViewSpec : false,
SVGZoomAndPan : false,
TimeEvent : false,
top : false,
URL : false,
WebSocket : false,
window : false,
Worker : false,
XMLHttpRequest : false,
XMLSerializer : false,
XPathEvaluator : false,
XPathException : false,
XPathExpression : false,
XPathNamespace : false,
XPathNSResolver : false,
XPathResult : false
};
exports.devel = {
alert : false,
confirm: false,
console: false,
Debug : false,
opera : false,
prompt : false
alert : false,
confirm: false,
console: false,
Debug : false,
opera : false,
prompt : false
};
exports.worker = {
importScripts: true,
postMessage : true,
self : true
importScripts: true,
postMessage : true,
self : true
};

@@ -360,4 +360,4 @@

exports.nonstandard = {
escape : false,
unescape: false
escape : false,
unescape: false
};

@@ -368,123 +368,123 @@

exports.couch = {
"require" : false,
respond : false,
getRow : false,
emit : false,
send : false,
start : false,
sum : false,
log : false,
exports : false,
module : false,
provides : false
"require" : false,
respond : false,
getRow : false,
emit : false,
send : false,
start : false,
sum : false,
log : false,
exports : false,
module : false,
provides : false
};
exports.node = {
__filename : false,
__dirname : false,
GLOBAL : false,
global : false,
module : false,
require : false,
__filename : false,
__dirname : false,
GLOBAL : false,
global : false,
module : false,
require : false,
// These globals are writeable because Node allows the following
// usage pattern: var Buffer = require("buffer").Buffer;
// These globals are writeable because Node allows the following
// usage pattern: var Buffer = require("buffer").Buffer;
Buffer : true,
console : true,
exports : true,
process : true,
setTimeout : true,
clearTimeout : true,
setInterval : true,
clearInterval : true,
setImmediate : true, // v0.9.1+
clearImmediate: true // v0.9.1+
Buffer : true,
console : true,
exports : true,
process : true,
setTimeout : true,
clearTimeout : true,
setInterval : true,
clearInterval : true,
setImmediate : true, // v0.9.1+
clearImmediate: true // v0.9.1+
};
exports.phantom = {
phantom : true,
require : true,
WebPage : true,
console : true, // in examples, but undocumented
exports : true // v1.7+
phantom : true,
require : true,
WebPage : true,
console : true, // in examples, but undocumented
exports : true // v1.7+
};
exports.rhino = {
defineClass : false,
deserialize : false,
gc : false,
help : false,
importPackage: false,
"java" : false,
load : false,
loadClass : false,
print : false,
quit : false,
readFile : false,
readUrl : false,
runCommand : false,
seal : false,
serialize : false,
spawn : false,
sync : false,
toint32 : false,
version : false
defineClass : false,
deserialize : false,
gc : false,
help : false,
importPackage: false,
"java" : false,
load : false,
loadClass : false,
print : false,
quit : false,
readFile : false,
readUrl : false,
runCommand : false,
seal : false,
serialize : false,
spawn : false,
sync : false,
toint32 : false,
version : false
};
exports.shelljs = {
target : false,
echo : false,
exit : false,
cd : false,
pwd : false,
ls : false,
find : false,
cp : false,
rm : false,
mv : false,
mkdir : false,
test : false,
cat : false,
sed : false,
grep : false,
which : false,
dirs : false,
pushd : false,
popd : false,
env : false,
exec : false,
chmod : false,
config : false,
error : false,
tempdir : false
target : false,
echo : false,
exit : false,
cd : false,
pwd : false,
ls : false,
find : false,
cp : false,
rm : false,
mv : false,
mkdir : false,
test : false,
cat : false,
sed : false,
grep : false,
which : false,
dirs : false,
pushd : false,
popd : false,
env : false,
exec : false,
chmod : false,
config : false,
error : false,
tempdir : false
};
exports.typed = {
ArrayBuffer : false,
ArrayBufferView : false,
DataView : false,
Float32Array : false,
Float64Array : false,
Int16Array : false,
Int32Array : false,
Int8Array : false,
Uint16Array : false,
Uint32Array : false,
Uint8Array : false,
Uint8ClampedArray : false
ArrayBuffer : false,
ArrayBufferView : false,
DataView : false,
Float32Array : false,
Float64Array : false,
Int16Array : false,
Int32Array : false,
Int8Array : false,
Uint16Array : false,
Uint32Array : false,
Uint8Array : false,
Uint8ClampedArray : false
};
exports.wsh = {
ActiveXObject : true,
Enumerator : true,
GetObject : true,
ScriptEngine : true,
ScriptEngineBuildVersion : true,
ScriptEngineMajorVersion : true,
ScriptEngineMinorVersion : true,
VBArray : true,
WSH : true,
WScript : true,
XDomainRequest : true
ActiveXObject : true,
Enumerator : true,
GetObject : true,
ScriptEngine : true,
ScriptEngineBuildVersion : true,
ScriptEngineMajorVersion : true,
ScriptEngineMinorVersion : true,
VBArray : true,
WSH : true,
WScript : true,
XDomainRequest : true
};

@@ -495,108 +495,108 @@

exports.dojo = {
dojo : false,
dijit : false,
dojox : false,
define : false,
"require": false
dojo : false,
dijit : false,
dojox : false,
define : false,
"require": false
};
exports.jquery = {
"$" : false,
jQuery : false
"$" : false,
jQuery : false
};
exports.mootools = {
"$" : false,
"$$" : false,
Asset : false,
Browser : false,
Chain : false,
Class : false,
Color : false,
Cookie : false,
Core : false,
Document : false,
DomReady : false,
DOMEvent : false,
DOMReady : false,
Drag : false,
Element : false,
Elements : false,
Event : false,
Events : false,
Fx : false,
Group : false,
Hash : false,
HtmlTable : false,
Iframe : false,
IframeShim : false,
InputValidator: false,
instanceOf : false,
Keyboard : false,
Locale : false,
Mask : false,
MooTools : false,
Native : false,
Options : false,
OverText : false,
Request : false,
Scroller : false,
Slick : false,
Slider : false,
Sortables : false,
Spinner : false,
Swiff : false,
Tips : false,
Type : false,
typeOf : false,
URI : false,
Window : false
"$" : false,
"$$" : false,
Asset : false,
Browser : false,
Chain : false,
Class : false,
Color : false,
Cookie : false,
Core : false,
Document : false,
DomReady : false,
DOMEvent : false,
DOMReady : false,
Drag : false,
Element : false,
Elements : false,
Event : false,
Events : false,
Fx : false,
Group : false,
Hash : false,
HtmlTable : false,
Iframe : false,
IframeShim : false,
InputValidator: false,
instanceOf : false,
Keyboard : false,
Locale : false,
Mask : false,
MooTools : false,
Native : false,
Options : false,
OverText : false,
Request : false,
Scroller : false,
Slick : false,
Slider : false,
Sortables : false,
Spinner : false,
Swiff : false,
Tips : false,
Type : false,
typeOf : false,
URI : false,
Window : false
};
exports.prototypejs = {
"$" : false,
"$$" : false,
"$A" : false,
"$F" : false,
"$H" : false,
"$R" : false,
"$break" : false,
"$continue" : false,
"$w" : false,
Abstract : false,
Ajax : false,
Class : false,
Enumerable : false,
Element : false,
Event : false,
Field : false,
Form : false,
Hash : false,
Insertion : false,
ObjectRange : false,
PeriodicalExecuter: false,
Position : false,
Prototype : false,
Selector : false,
Template : false,
Toggle : false,
Try : false,
Autocompleter : false,
Builder : false,
Control : false,
Draggable : false,
Draggables : false,
Droppables : false,
Effect : false,
Sortable : false,
SortableObserver : false,
Sound : false,
Scriptaculous : false
"$" : false,
"$$" : false,
"$A" : false,
"$F" : false,
"$H" : false,
"$R" : false,
"$break" : false,
"$continue" : false,
"$w" : false,
Abstract : false,
Ajax : false,
Class : false,
Enumerable : false,
Element : false,
Event : false,
Field : false,
Form : false,
Hash : false,
Insertion : false,
ObjectRange : false,
PeriodicalExecuter: false,
Position : false,
Prototype : false,
Selector : false,
Template : false,
Toggle : false,
Try : false,
Autocompleter : false,
Builder : false,
Control : false,
Draggable : false,
Draggables : false,
Droppables : false,
Effect : false,
Sortable : false,
SortableObserver : false,
Sound : false,
Scriptaculous : false
};
exports.yui = {
YUI : false,
Y : false,
YUI_config: false
YUI : false,
Y : false,
YUI_config: false
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc