-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from highcharts/v1.0.6
v1.0.6
- Loading branch information
Showing
7 changed files
with
938 additions
and
870 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* @fileoverview The global Highcharts namespace should not be used, as it makes | ||
* type modifications difficult. Instead write declarations in `.d.ts` files | ||
* and make use of `declare module...` in `.ts` files for further extension. | ||
*/ | ||
'use strict'; | ||
|
||
const message = 'Do not use the global Highcharts namespace for declarations.'; | ||
|
||
//------------------------------------------------------------------------------ | ||
// Rule Definition | ||
//------------------------------------------------------------------------------ | ||
|
||
module.exports = { | ||
meta: { | ||
docs: { | ||
description: message, | ||
category: 'Migration', | ||
recommended: false | ||
}, | ||
fixable: null, // or "code" or "whitespace" | ||
schema: [ | ||
// fill in your schema | ||
] | ||
}, | ||
|
||
create: function (context) { | ||
|
||
// variables should be defined here | ||
const code = context.getSourceCode().lines.join('\n'); | ||
|
||
//---------------------------------------------------------------------- | ||
// Helpers | ||
//---------------------------------------------------------------------- | ||
const program = (node) => { | ||
|
||
const regex = /namespace (Highcharts)/g; | ||
|
||
let match; | ||
|
||
while (match = regex.exec(code)) { | ||
const codeBefore = code.substr(0, regex.lastIndex - match[1].length); | ||
const linesBefore = codeBefore.split('\n'); | ||
const line = linesBefore[linesBefore.length - 1]; | ||
|
||
context.report({ | ||
node: node, | ||
loc: { | ||
line: linesBefore.length, | ||
column: line.length | ||
}, | ||
message: message | ||
}); | ||
} | ||
}; | ||
|
||
//---------------------------------------------------------------------- | ||
// Public | ||
//---------------------------------------------------------------------- | ||
return { | ||
|
||
Program: program | ||
|
||
}; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* @fileoverview Create and use events instead of mixins modifications. | ||
*/ | ||
'use strict'; | ||
|
||
const message = 'Do not use mixins.'; | ||
|
||
//------------------------------------------------------------------------------ | ||
// Rule Definition | ||
//------------------------------------------------------------------------------ | ||
|
||
module.exports = { | ||
meta: { | ||
docs: { | ||
description: message, | ||
category: 'Migration', | ||
recommended: false | ||
}, | ||
fixable: null, // or "code" or "whitespace" | ||
schema: [ | ||
// fill in your schema | ||
] | ||
}, | ||
|
||
create: function (context) { | ||
|
||
// variables should be defined here | ||
const code = context.getSourceCode().lines.join('\n'); | ||
|
||
//---------------------------------------------------------------------- | ||
// Helpers | ||
//---------------------------------------------------------------------- | ||
const program = (node) => { | ||
|
||
const regex = /(?:import|from)\s+\'[^']*\/(Mixins\/)/g; | ||
|
||
let match; | ||
|
||
while (match = regex.exec(code)) { | ||
const codeBefore = code.substr(0, regex.lastIndex - match[1].length); | ||
const linesBefore = codeBefore.split('\n'); | ||
const line = linesBefore[linesBefore.length - 1]; | ||
|
||
context.report({ | ||
node: node, | ||
loc: { | ||
line: linesBefore.length, | ||
column: line.length | ||
}, | ||
message: message | ||
}); | ||
} | ||
}; | ||
|
||
//---------------------------------------------------------------------- | ||
// Public | ||
//---------------------------------------------------------------------- | ||
return { | ||
|
||
Program: program | ||
|
||
}; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* @fileoverview Create and use events instead of wrap modifications. | ||
*/ | ||
'use strict'; | ||
|
||
const message = 'Do not use wrap.'; | ||
|
||
//------------------------------------------------------------------------------ | ||
// Rule Definition | ||
//------------------------------------------------------------------------------ | ||
|
||
module.exports = { | ||
meta: { | ||
docs: { | ||
description: message, | ||
category: 'Migration', | ||
recommended: false | ||
}, | ||
fixable: null, // or "code" or "whitespace" | ||
schema: [ | ||
// fill in your schema | ||
] | ||
}, | ||
|
||
create: function (context) { | ||
|
||
// variables should be defined here | ||
const code = context.getSourceCode().lines.join('\n'); | ||
|
||
//---------------------------------------------------------------------- | ||
// Helpers | ||
//---------------------------------------------------------------------- | ||
const program = (node) => { | ||
|
||
const regex = /(?:^|\s)(wrap\s*\()/g; | ||
|
||
let match; | ||
|
||
while (match = regex.exec(code)) { | ||
const codeBefore = code.substr(0, regex.lastIndex - match[1].length); | ||
const linesBefore = codeBefore.split('\n'); | ||
const line = linesBefore[linesBefore.length - 1]; | ||
|
||
context.report({ | ||
node: node, | ||
loc: { | ||
line: linesBefore.length, | ||
column: line.length | ||
}, | ||
message: message | ||
}); | ||
} | ||
}; | ||
|
||
//---------------------------------------------------------------------- | ||
// Public | ||
//---------------------------------------------------------------------- | ||
return { | ||
|
||
Program: program | ||
|
||
}; | ||
} | ||
}; |
Oops, something went wrong.