forked from jens-ox/eslint-plugin-material-ui-unused-classes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
41 lines (37 loc) · 883 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const eslint = require('eslint');
const rule = require('./rule');
const ruleTester = new eslint.RuleTester({
parser: require.resolve('@typescript-eslint/parser'),
parserOptions: {
ecmaFeatures: { jsx: true },
},
});
ruleTester.run('warn-unused-classes', rule, {
valid: [
`const useStyles = makeStyles(() => ({
testClass: {
backgroundColor: 'red'
}
}))
const Component = () => {
const classes = useStyles()
return <div className={classes.testClass}>test</div>
}`,
],
invalid: [
{
code: `const useStyles = makeStyles(() => ({
testClass: {
backgroundColor: 'red'
}
}))
const Component = () => {
const classes = useStyles()
return <div>test</div>
}`,
errors: [{
message: 'Class `testClass` is unused'
}]
},
],
});