* Apply all linting options according to the status of the `state` object.
()
| 19139 | * Apply all linting options according to the status of the `state` object. |
| 19140 | */ |
| 19141 | function applyOptions() { |
| 19142 | var badESOpt = null; |
| 19143 | processenforceall(); |
| 19144 | |
| 19145 | /** |
| 19146 | * TODO: Remove in JSHint 3 |
| 19147 | */ |
| 19148 | badESOpt = state.inferEsVersion(); |
| 19149 | if (badESOpt) { |
| 19150 | quit("E059", state.tokens.next, "esversion", badESOpt); |
| 19151 | } |
| 19152 | |
| 19153 | if (state.inES5()) { |
| 19154 | combine(predefined, vars.ecmaIdentifiers[5]); |
| 19155 | } |
| 19156 | |
| 19157 | if (state.inES6()) { |
| 19158 | combine(predefined, vars.ecmaIdentifiers[6]); |
| 19159 | } |
| 19160 | |
| 19161 | /** |
| 19162 | * Use `in` to check for the presence of any explicitly-specified value for |
| 19163 | * `globalstrict` because both `true` and `false` should trigger an error. |
| 19164 | */ |
| 19165 | if (state.option.strict === "global" && "globalstrict" in state.option) { |
| 19166 | quit("E059", state.tokens.next, "strict", "globalstrict"); |
| 19167 | } |
| 19168 | |
| 19169 | if (state.option.module) { |
| 19170 | /** |
| 19171 | * TODO: Extend this restriction to *all* ES6-specific options. |
| 19172 | */ |
| 19173 | if (!state.inES6()) { |
| 19174 | warning("W134", state.tokens.next, "module", 6); |
| 19175 | } |
| 19176 | } |
| 19177 | |
| 19178 | if (state.option.couch) { |
| 19179 | combine(predefined, vars.couch); |
| 19180 | } |
| 19181 | |
| 19182 | if (state.option.qunit) { |
| 19183 | combine(predefined, vars.qunit); |
| 19184 | } |
| 19185 | |
| 19186 | if (state.option.rhino) { |
| 19187 | combine(predefined, vars.rhino); |
| 19188 | } |
| 19189 | |
| 19190 | if (state.option.shelljs) { |
| 19191 | combine(predefined, vars.shelljs); |
| 19192 | combine(predefined, vars.node); |
| 19193 | } |
| 19194 | if (state.option.typed) { |
| 19195 | combine(predefined, vars.typed); |
| 19196 | } |
| 19197 | |
| 19198 | if (state.option.phantom) { |
no test coverage detected